|
|
the store had the product, but sold it = the store did not have the product if (!Products.count(name) || !Products[name]) Purchases.erase(Purchases.begin() + i); Test: 1 10 of gg 3 1 of ff 10 of gg 9 of gg Correct Answer: 3 Edited by author 25.11.2021 23:40 Try this: 3 2 of sweets 5 of milk 1 of sausage 4 6 of milk 3 of milk 1 of milk 3 of sweets Correct answer is: 8 Good luck! Could anyone give me some tests for this one? Could anyone give me some tests for this one? Could someone give me some tests for this one? Try this test case: 1 1 of vodka 1 2 of vodka Answer = 1 Thank you! I was being mad about this WA during the contest. :) Why answer is 1? He wants more than is in the shop, so he calls his wife and asks her. This means that the answer is 2. Or I misunderstood? Because he is letting our hero go in front of him, which is the main objective. Could anyone, please, explain it to me? I can't understand how to program it. I'm filling the "amount of name" for the storage in the shop and for the queue, then, for each human from the queue, I check, firstly, whether the shop has the product the customer needs to buy, and then, if the shop has it, I compare the amounts. But I have a problem in understanding the part where the shop doesn't have enough of the product and the customers switch places. Could anyone explain it to me? What it is test 20 ? Edited by author 27.07.2016 17:35 Edited by author 27.07.2016 17:35 Edited by author 27.07.2016 18:36 My programm passes all tests from forum, but i still got WA 10. Have anybody some more tricky tests? It's too funy! I forgot to check one little moment if(goods[v[0].s] == 0){ time++; v.pop_front(); continue; } Or try this test: 1 1 of hell 3 1 of lol 2 of azaz 3 of bug Answer: 3, but my old programm gives 5 LOL, Good Luck! My problem is not this that gives the correct answer, but despite that WA9 Try this: 1 1 of a 3 1 of a 1 of a 1 of b Correct answer is 3. Help please. give please test #22. I can't Imagine what can be wrong in my programm hi ,do you konw why it's wrong now? Could you please help me? Hello gentlemen! Who can explain why I get WA8? Are there any test data available to anyone? 1 10 of anawa 2 10 of anawa 1 of anawa answer = 2 not 3 Edited by author 24.10.2010 04:07 I've got this answer, but WA8 too. Try this test 1 2 of vodka 1 3 of vodka answer 1 Yes, it is ;) Edited by author 22.07.2012 20:26 Edited by author 22.07.2012 20:26 Edited by author 22.07.2012 20:31 2 100 of vodka 1 of matryoshka 3 100 of vodka 1 of vodka 1 of matryoshka I had a stupid mistake Instead of: shop[want] -= q[r].amount; I had: shop[want] = q[r].amount; Or give me some tests please. All tests that were proposed on the forum shows correct result. The main loop is: while (head != n) { if (id[head] != -1) { int have = shop[id[head]].count; if (have > 0) { if (want[head] > have) { if (head == n - 1) { ++time; break; } swap(id[head], id[head + 1]); swap(want[head], want[head + 1]); want[head + 1] = have; } else { shop[id[head]].count = have - want[head]; ++head; } } else ++head; } else ++head; ++time; } Edited by author 19.04.2013 14:14 Edited by author 19.04.2013 14:14 I think that the problem is in the function swap() which doesn't work in Java. Your guess is wrong. I wrote swap method. Also I used my own hashing. Maybe this is the root cause. please, give me some test Check the situation when one husband comes back for the second time, the quantity he wants to buy was modified meanwhile ... I had the same WA, but now I have AC I had wa 14 in this case: when husband returns the second time and amount was not changed then I forgot to set amount to 0 (husband buy this product) May answer be a floating point number? "телефонный разговор с женой длится полминуты." Or I should to round answer? Sorry, I understand what does this statement mean. Edited by author 23.05.2012 16:33 Too easy and fun problem :) deque + map = Accepted. #include <iostream> using namespace std; int main() {long n,m,a[1010],b[1010],c[1010],k,i,e,j,q; char t[1010][25],g[1010][25]; cin >> m; for (i=1;i<=m;i++){ cin >> a[i] >> t[0] >> t[i]; } cin >> n; for (i=1;i<=n;i++){ cin >> b[i] >> g[0] >> g[i]; } for (i=1;i<=n;i++)c[i]=0; for (i=1;i<=n;i++){ for (j=1;j<=m;j++){ k=1; for (e=0;e<=21;e++){ if (g[i][e]!=t[j][e])k=0; } if (k==1)c[i]=j; } } a[0]=0; q=0; for (i=1;i<=n;i++){ asd:; q++; if (a[c[i]]==0){goto lkj;} if (a[c[i]]>=b[i]){ a[c[i]]=a[c[i]]-b[i]; goto lkj; } if ((a[c[i]]<b[i])&&(i<n)){ b[i]=b[i+1]; b[i+1]=a[c[i]]; k=c[i]; c[i]=c[i+1]; c[i+1]=k; goto asd; } if ((a[c[i]]<b[i])&&(i==n)){ b[i]=a[c[i]]; goto lkj; } lkj:; } cout << q; cin >> i; return 0; } check name "of" you compare strings by the cycle k=1; for (e=0;e<=21;e++){ if (g[i][e]!=t[j][e])k=0; } if (k==1)c[i]=j; this will be correct if you init arrays char t[1010][25],g[1010][25]; to 0. And your program will take AC!!! Can anyone give me test 9? Edited by author 22.11.2011 01:47 Can you give some tests for WA#10 This simple test helped me: 1 2 of sweets 4 2 of sweets 3 of sweets 3 of sweets 5 of sweets Answer is: 4 |
|
|