| Show all threads     Hide all threads     Show all messages     Hide all messages | 
| GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!! | WuLF | 1430. Crime and Punishment | 6 Mar 2024 16:53 | 10   | 
GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!! [code deleted]   this right?   Edited by moderator 22.02.2006 00:38 var a,b,n,k1,k2:longint; begin  readln(a,b,n);   while n>=a  do    begin     n:=n-a;     k1:=k1+1;    end;   while n>=b do    begin     n:=n-b;     k2:=k2+1;    end;  writeln(k1,' ',k2); end. земляк помоги решить 10 задачу или проверь Do you check if N=0?? sorry for doublepost   Edited by author 11.02.2006 16:13 Whay it does not work too? (WA#2)   var    a, b, n: LongInt;    x,y,xo,yo,q,w: LongInt;   begin Read(a, b, n);   x := n div a; xo := n mod a; y := n div b; yo := n mod b; q := x * a + xo div b * b; w := y * b + yo div a * a;   If q >= w then    WriteLn(x, ' ', xo div b) Else    WriteLn(yo div a, ' ', y); end. 47 3 49 ans: 0 16 2 3 7 ans: 2 1 It is not guaranteed that A >= B and 2 test checks this. AFAIK if you will throw error if B > A, then you will get Runtime Error on test 2.   Edited by author 06.03.2024 16:54  | 
| This may help if WA 7 | MishaRash | 1430. Crime and Punishment | 9 Feb 2020 14:56 | 3   | 
I have WA 7 and I found the problem on test '20 30 13456'. It's a nice case to fix program but still it doesn't fix WA7.   Edited by author 09.02.2020 15:46  | 
| No subject | Yaroslaff | 1430. Crime and Punishment | 16 Mar 2018 13:04 | 1   | 
 | 
| Little Hint with mathematics | Mickkie | 1430. Crime and Punishment | 16 Oct 2016 12:51 | 2   | 
My approach divides into 2 cases   I) A>= sqrt(N) or B>=sqrt(N)   this can be solved by brute force in O(sqrt(N))   II) A<sqrt(N) and B<sqrt(N)   now this is more interesting   in case of gcd(A,B)=1   you can proof that there exist x,y>=0 that A*x+B*y = N     since A*x congruent to N (mod B) -> x = N*inv(A,B) % B     hence 0<=x<=B-1 but B<sqrt(N) and A<sqrt(N)     then A*x < N so y >= 0   in case of gcd(A,B)>1     that's your work!   :)  | 
| WA 16, or how I lost 13 tries | [RISE] Levon Oganesyan [RAU] | 1430. Crime and Punishment | 20 Jul 2014 20:50 | 3   | 
Hi all.   I tried to solve this problem with standart method. I devide all numbers on GCD, and calculate all x in A*x + B*y and I tried find the maximum T, T <= N.   In cicle I write something like this: if ( max < T ) {    max = T;    //something too } and have WA16. After WA16 I tried fix my program, but don't find anything global. Fix something right on wrong, I 13 times get WA 1 - 16.   Then I changed ( max < T ) on ( max <= T ), and don't send, because did not think, what that will be changed WA16 on AC. I was wrong.   I don't know why that fix is right, can someone explain me?   Thanks. Sorry for bad English. Ouch... Thanks, I understood my problem. I am write int q, w; instead of int q = 0, w = 0;  | 
| GIVE ME SOME TEST PLEASE!!!!!!! | WuLF | 1430. Crime and Punishment | 12 Dec 2013 08:52 | 2   | 
Who solved it. GIVE ME SOME TEST PLEASE!!!!!!! GIVE ME SOME TEST PLEASE!!!!!  | 
| Hint | TakeOver | 1430. Crime and Punishment | 10 Jan 2013 01:07 | 1   | 
Hint TakeOver 10 Jan 2013 01:07 when you search x and y (A*x+B*y = N) use something like this for x:= 0 to min(n div a, trunc(sqrt(n))) do =)  | 
| AC | Rauf Agayev | 1430. Crime and Punishment | 27 Nov 2011 00:06 | 4   | 
AC Rauf Agayev 23 Mar 2011 23:01 Given A B N D=GCD(A,B); then N/=D and N*=D and N/=D;because we must find closed number to N; A/=D; B/=D;   then full search   if(A>B) for(i=0;i<=N/A;i++){type here equation Ai+By=N, try to find x and y}                 else for(i=0;i<=N/B;i++){type here equation Ax+Bi=N , try to find x and y}   *trick:in loop, if Ax+By=N then break,that means we have already found number..     Edited by author 24.03.2011 01:44 Re: AC sklyack 27 Aug 2011 01:34 I did how you said, and when I tried to pass this solution without trick, I got TL#10, with trick got AC in 0.031 sec. I really don't understand, how this trick can give so impressive speed-up? Explain me pls!! Re: AC -XraY- 18 Nov 2011 23:56 Let's suppose A >= B,  (A, B) = 1; Then there is such (0 <= i < b) that (a * i) % b = (N % b). On the other hand, i <= N / a. So, i <= min(N / a, b - 1) <= min(N / a, a - 1) <= sqrt(n); Re: AC sklyack 27 Nov 2011 00:06  | 
| limitation for the full search | luckysundog | 1430. Crime and Punishment | 18 Nov 2011 23:34 | 2   | 
Suppose: 1) A>B 2) gcd(A,B)=1 Need to find maximal A*x + B*y I try all 0 <= x <= (N-B) / A + 1 This upper limit gives AC, but is it optimal?     Edited by author 18.11.2011 23:48  | 
| WA#3 | Anton | 1430. Crime and Punishment | 19 Oct 2011 13:15 | 1   | 
WA#3 Anton 19 Oct 2011 13:15 I have no idea ... If somebody've got AC, send some tests, pls  | 
| please give me idea to solve this problem, thanks!!! | hoan | 1430. Crime and Punishment | 3 Jan 2011 19:57 | 5   | 
Just full search. ~O(sqrt(N)) in the worst case. To avoid TL before search do: C = GCD(A,B); A /= C; B /= C; N -= (N%C); Think why you always can do this. GOOD LUCK! Oh! I forgot, that after that N must be divided by C too :) got AC now. thanx again & HAPPY NEW YEAR!!!  | 
| HINT for those who got TLE on #24 | Chantat Eksombatchai[PONG] | 1430. Crime and Punishment | 10 Mar 2010 19:54 | 7   | 
B can be greater than A Good Luck ^^ N'Pong Thx for your hint.   from P'Moo   Edited by author 07.01.2007 11:30 Thx a lot! but why goods at moderate price cost higher than "high price" good? I don't care for value of b :)  | 
| If you have WA26, then use long long. | Sobolev_Team (Zhenya Sobolev, Dima Sobolev) | 1430. Crime and Punishment | 6 Jul 2009 23:31 | 1   | 
 | 
| WA on test7 | Erjin Zhou | 1430. Crime and Punishment | 31 Mar 2009 13:57 | 1   | 
I need help... what is the test 7?  | 
| WA#24....Please help me... | rohit | 1430. Crime and Punishment | 31 Aug 2008 06:02 | 3   | 
Please tell me what is test..I m stuck at this problem for long time. Guys...please tell me..I am sure my algo is correct. Maybe overflow? I use int64 everywhere.  | 
| WA24 | rohit | 1430. Crime and Punishment | 14 Feb 2008 03:23 | 1   | 
WA24 rohit 14 Feb 2008 03:23 Please tell me what test..I am stuck at this problem for long time.   Edited by author 19.04.2008 02:47   Edited by author 19.04.2008 02:48  | 
| Problem 1430 "Crime and punishment" has been rejudged (+) | Sandro (USU) | 1430. Crime and Punishment | 13 Sep 2007 12:53 | 1   | 
New tricky tests were added. Some authors got TL. Thanks to Boris Parfenenkov for idea of tests.  | 
| Give me some test pls. I got WA26 | Valery | 1430. Crime and Punishment | 30 Jun 2007 16:39 | 1   | 
Give me some test:), or may be some think wrong with test????  | 
| Why WA on #24 | The Punisher | 1430. Crime and Punishment | 15 Jan 2007 23:31 | 4   | 
First I got TL on #24 Then I got WA on #24 Are there large answer?  Thanks. No. No large answer. How could it be large? Everything is quite simple. You can solve this problem occasionally, even if not think much. I try to took "j" goods for A$ and  goods for B$ on rest money. Then I try to took "j" goods for B$ and goods for A$ on rest money. 0<="j"<=min(n/a,b) What's wrong? My single idea :my code can generate negative numbers as answer. I don't understand anything...  | 
| Give me some test please!!!!! I've got WA!!! | WuLF | 1430. Crime and Punishment | 30 Aug 2006 22:48 | 5   | 
Give me some test please!!!!! I've got WA!!!   Edited by author 11.02.2006 14:28 My output is '2 17'. It is correct, but still WA#2.  |