There is an ATM machine. Initially, it contains a total of K units of money. N people (numbered 1 through N) want to wit
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
There is an ATM machine. Initially, it contains a total of K units of money. N people (numbered 1 through N) want to wit
Constraints . . •1 <T < 100 •1<N< 100 •1 < A; = 1,000,000 for each valid i .13K < 1,000,000 . Sample Input 1 2 5 10 3 5 3 2 1 4 6 10 8 6 4 Sample Output 1 % 11010 0010 Explanation Example case 1: The ATM machine initially contains 10 units of money. The first person comes and withdraws 3 units, so the amount remaining in the machine is 7. Then the second person withdraws 5 units and the remaining amount is 2. The third person wants to withdraw 3 units, but since there are only 2 units of money in the machine, it throws an error and the third person must leave without getting anything. Then the fourth person withdraws 2 units, which leaves nothing in the machine, so the last person does not get anything.
Example case 2: The ATM machine initially contains 6 units of money, so it cannot give anything to the first and second person. When the third person comes, it gives them all the money it has, so the last person does not get anything either. Author: 6x kingofnumbers Editorial: https://discuss.codechef.com/problems/ATM2 Tags: ad-hoc, cakewalk, cook98, kingofnumbers, simulation, taran 1407 Difficulty Rating: 1001 Date Added: 21-09-2018 Time Limit: 1 secs Source Limit: 50000 Bytes Languages: PYTH 3.6, JAVA, C, CPP14, PYTH, PYP3, CS2, ADA, PYPY, TEXT, PAS fpc, NODEJS, RUBY, PHP, GO, HASK, TCL, kotlin, PERL, SCALA, LUA, BASH, JS, rust, LISP sbcl, PAS gpc, BF, CLOJ, D, CAML, swift, FORT, ASM, FS, WSPC, LISP clisp, SCM guile, PERL6, ERL, CLPS, PRLG, ICK, NICE, ICON, COB, SCM chicken, PIKE, SCM qobi, ST, NEM