Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | Could you give me some tests??? I have WA#1!!! PLEASE!!!!! | BOyKA | 1167. Bicolored Horses | 15 ноя 2012 12:07 | 1 | | | Some In & Out | daftcoder [Yaroslavl SU] | 1377. Лара Крофт | 15 ноя 2012 02:15 | 4 | Here some data that helps me to find a bug. 0) 4 4 1 1 3 2 - 15 1) 4 5 1 1 3 2 - 19 2) 5 4 1 1 3 2 - 19 3) 5 5 1 1 3 3 - 24 4) 3 1 1 1 3 1 - 2 5) 1 3 1 1 1 3 - 2 Give some comments plz if it helped you. =) Good luck! All your tests are working. But I'm always getting WA4... What may it be? :'( | | WA 8, please give me test!!! | Sorry | 1637. Игра в треугольник 2 | 15 ноя 2012 01:09 | 1 | #include<stdio.h> #include<iostream> void swap(int &a, int &b) { int t=a;a=b;b=t; } void ay(int &x1,int &x2, int &x3) { if(x1>=x2&&x1>=x3) { x2=x1+(x1-x2); x3=x1+(x1-x3); return; } if(x2>=x1&&x2>=x3) { x1=x2+(x2-x1); x3=x2+(x2-x3); return; } if(x3>=x1&&x3>=x2) { x1=x3+(x3-x1); x2=x3+(x3-x2); return; } } int f(int _X1,int _X2,int _X3,int _x1,int _x2,int _x3) { int X1=_X1,X2=_X2,X3=_X3,x1=_x1,x2=_x2,x3=_x3;
if(X1==x1&&X2==x2&&X3==x3)return 0;
ay(X1,X2,X3); if(x1-X1==x2-X2&&x1-X1==x3-X3&&(x1-X1)%2==0)return 1; ay(X1,X2,X3); if(x1-X1==x2-X2&&x1-X1==x3-X3&&(x1-X1)%2==0)return 2; return -1; } void ff(int &ans, int &k1, int &k2) { if(k1!=-1&&k2!=-1&&k1+k2<ans)ans=k1+k2; } int main() { int x1,y1,x2,y2,x3,y3,X1,Y1,X2,Y2,X3,Y3,ans=30; scanf("%i %i %i %i %i %i",&x1,&y1,&x2,&y2,&x3,&y3); scanf("%i %i %i %i %i %i",&X1,&Y1,&X2,&Y2,&X3,&Y3);
int k1,k2; k1=f(X1,X2,X3,x1,x2,x3); k2=f(Y1,Y2,Y3,y1,y2,y3); ff(ans,k1,k2); k1=f(X1,X3,X2,x1,x2,x3); k2=f(Y1,Y3,Y2,y1,y2,y3); ff(ans,k1,k2); k1=f(X2,X1,X3,x1,x2,x3); k2=f(Y2,Y1,Y3,y1,y2,y3); ff(ans,k1,k2); k1=f(X2,X3,X1,x1,x2,x3); k2=f(Y2,Y3,Y1,y1,y2,y3); ff(ans,k1,k2); k1=f(X3,X1,X2,x1,x2,x3); k2=f(Y3,Y1,Y2,y1,y2,y3); ff(ans,k1,k2); k1=f(X3,X2,X1,x1,x2,x3); k2=f(Y3,Y2,Y1,y1,y2,y3); ff(ans,k1,k2);
if(ans==30)puts("IMPOSSIBLE"); else printf("%i",ans); return 0; } Thank's | | How to get 0.015 with 112 memory? | Victor | 1264. Трудовые будни | 14 ноя 2012 23:37 | 2 | | | I had WA14 but... | MOPDOBOPOT (USU) | 1133. Последовательность Фибоначчи | 14 ноя 2012 23:31 | 5 | When I used longint I got WA11, but I changed it into int64 and got WA14. Then, I changed int64 into extended and got AC! :) how did u change it?plz write the code a:array[-1000..1000]of int64; => a:array[-1000..1000]of extended; :) can you help me for this, how can I extend in c++ long long (int 64) to a bigger type? | | WA#9 | RASTA | 1351. Хороший гнусмас – мёртвый гнусмас | 14 ноя 2012 21:27 | 5 | WA#9 RASTA 18 мар 2009 22:19 const eps = 1e-9; var a1, b1, a2, b2, x, y, x1, y1, d, x2, y2: real; i, n: longint; Begin read(d, x1, y1, x2, y2); read(n); a1 := y1; b1 := -x1; a2 := y2; b2 := -x2; for i := 1 to n do begin read(x, y); if (abs(x1 - x2) < eps) and (abs(y1 - y2) < eps) then begin if (abs(a1 * x + b1 * y) < eps) and (x * x + y * y - eps <= d * d) and (abs(sqrt(x * x + y * y) + sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) - sqrt(x1 * x1 + y1 * y1)) < eps) then writeln('YES') else writeln('NO') end else if (a1 * x + b1 * y - eps <= 0) and (a2 * x + b2 * y + eps >= 0) and (x * x + y * y - eps <= d * d) then writeln('YES') else writeln('NO'); end; End. I solve this problem with type longint but it makes no difference... try this: 5 1 0 1 0 1 -1 0 corect is NO ...and it is more useful to use Longint instead of real to solve this problem. To compare distances use sqr of distances Re: WA#9 [SPB SU of Telecom] Valdemar 14 ноя 2012 21:27 This test helped me: 1007 20 25 4 5 1 -16 -20 Answer : NO Edited by author 14.11.2012 21:28 This test helped me 5 0 1 0 1 1 0 1 correct answer: YES | | WA#11 | ROHAN GULATI | 1146. Maximum Sum | 14 ноя 2012 19:13 | 1 | WA#11 ROHAN GULATI 14 ноя 2012 19:13 Please can anybody tell me what is test case #11 | | k(11) = 55, k(13) = 78? | SpBerkut | 1744. Рота Капитана | 14 ноя 2012 15:53 | 1 | | | Maybe an interesting idea to solve this | Doctor Lai | 1915. Руины титанов: воссоздание былого | 14 ноя 2012 15:35 | 3 | Instead of copying actually data, we might put a marked-number (index to copy) in the array. For example, if (x > 0) { stack[q ++] = x; } else if (x == -1) { int y = stack[q - 1]; if (y > 0) { System.out.println(y); q--; } else { y = -y; System.out.println(stack[y]); stack[q - 1] = -(y - 1); if (y == 0) { q--; } } } else { stack[q] = -(q - 1); // negative numbers mean a copy. q ++; } of course, this doesn't work for multiple continuous copy (e.g. 0, 0, 0 ..). I pursued this idea at first before I noted the easier approach based on the input constraints. The problem with storing markers representing copies in the stream is that it gets complicated when you have many combinations of partially consumed copies which are then copied, over and over again. You basically need a tree to represent the state, and the tree must be walked when popping, which takes longer. There probably is a simplified partial implementation of this, but given the constraints of the problem, it's not necessary. I agree. It gets complicated when there are copies inside copies.. so, this is not necessary because there are simpler and straightforward solutions. | | Solution ratings are not considering the memory usage? | Xun Li | | 14 ноя 2012 15:32 | 3 | It seems like the solution ratings are first sorted based on runtime, and then if a tie, on the time of submission which does not make too much sense. Maybe it should be sorted based on memory usage if a tie on runtime? Rating based on time of submission gives incentive to be the first to solve new problems. I agree that including memory usage in rating makes sense though. There is a bug. If you have multiple submissions of same execution time but different memory usage. The final solution ratings will be still showing the first submission even your second submission uses less memory at the same execution time. | | You can get it in just about O(sqrt(n)) | nickolas stoudemire | 1120. Сумма последовательных чисел | 14 ноя 2012 00:18 | 3 | You can prove it with the knowledge of maths. Edited by author 22.08.2007 14:43 There is more strong aproximation. O(n^1/3) | | Interesting hint to solve this problem | Bekzhan | 1297. Палиндромы | 13 ноя 2012 23:38 | 1 | This is hint: maximal substring-palindrome is maximal common substring of given string and reversed string => You can solve it for O(N^2). The second variant - trivial dynamic. dp[l][r] = answer for substring from l to r. Sorry for my poor english((( Edited by author 13.11.2012 23:38 | | My question on timings in general | Doctor Lai | | 13 ноя 2012 23:15 | 2 | Just a quick question.. the timings set for each problem, for example, maximum 1 second. Does this one second refer to the execution time of all tests or just for each test point? I guess, it is for each test point. am I right? | | Do I understand that problem can solved without mass? | SpBerkut | 1372. Звезда смерти | 13 ноя 2012 19:09 | 1 | I need to cаlculate sum of torques about axes, right. T = ∑F·d = 0, where T is torque, F is vector of force, d is distance from F to center of sphere. Is it right? | | O((2*n+1)*(2*n+1)) | Sunnat | 1933. Пушки к бою! | 13 ноя 2012 18:23 | 1 | | | O(n) C Accepted 0.031 108 КБ | Sunnat | 1574. Математики и скобки | 13 ноя 2012 18:19 | 1 | while((ch=getchar())!='\n') { if(ch==')') { ... } else { .... } printf("%i",(!K)*ans); } | | please give me any test for my code!!! | Sunnat | 1637. Игра в треугольник 2 | 13 ноя 2012 17:44 | 2 | #include<stdio.h> int f(int X1,int X2,int X3,int x1,int x2,int x3) { if(X1==x1&&X2==x2&&X3==x3)return 0; if(x3+X1==x1+X3&&x3+X1==x2+X2&&(x3+X1)%2==0)return 1; if(x1-X1==x2-X2&&x1-X1==x3-X3&&(x1-X1)%2==0)return 2; return -1; } void ff(int &ans, int &k1, int &k2) { if(k1!=-1&&k2!=-1&&k1+k2<ans)ans=k1+k2; } int main() { int x1,y1,x2,y2,x3,y3,X1,Y1,X2,Y2,X3,Y3,ans=30; scanf("%i %i %i %i %i %i",&x1,&y1,&x2,&y2,&x3,&y3); scanf("%i %i %i %i %i %i",&X1,&Y1,&X2,&Y2,&X3,&Y3); int k11,k12,k21,k22,k31,k32,k41,k42,k51,k52,k61,k62; k11=f(X1,X2,X3,x1,x2,x3); k12=f(Y1,Y2,Y3,y1,y2,y3); k21=f(X1,X3,X2,x1,x2,x3); k22=f(Y1,Y3,Y2,y1,y2,y3); k31=f(X2,X1,X3,x1,x2,x3); k32=f(Y2,Y1,Y3,y1,y2,y3); k41=f(X2,X3,X1,x1,x2,x3); k42=f(Y2,Y3,Y1,y1,y2,y3); k51=f(X3,X1,X2,x1,x2,x3); k52=f(Y3,Y1,Y2,y1,y2,y3); k61=f(X3,X2,X1,x1,x2,x3); k62=f(Y3,Y2,Y1,y1,y2,y3);
ff(ans,k11,k12); ff(ans,k21,k22); ff(ans,k31,k32); ff(ans,k41,k42); ff(ans,k51,k52); ff(ans,k61,k62);
if(ans==30)puts("IMPOSSIBLE"); else printf("%i",ans); return 0; } 1 2 3 #include<stdio.h> int f(int X1,int X2,int X3,int x1,int x2,int x3) { if(X1==x1&&X2==x2&&X3==x3)return 0; if(x3+X1==x1+X3&&x3+X1==x2+X2&&(x3+X1)%2==0)return 1; if(x1-X1==x2-X2&&x1-X1==x3-X3&&(x1-X1)%2==0)return 2; return -1; } void ff(int &ans, int &k1, int &k2) { if(k1!=-1&&k2!=-1&&k1+k2<ans)ans=k1+k2; } int main() { int x1,y1,x2,y2,x3,y3,X1,Y1,X2,Y2,X3,Y3,ans=30; scanf("%i %i %i %i %i %i",&x1,&y1,&x2,&y2,&x3,&y3); scanf("%i %i %i %i %i %i",&X1,&Y1,&X2,&Y2,&X3,&Y3); int k11,k12,k21,k22,k31,k32,k41,k42,k51,k52,k61,k62; k11=f(X1,X2,X3,x1,x2,x3); k12=f(Y1,Y2,Y3,y1,y2,y3); k21=f(X1,X3,X2,x1,x2,x3); k22=f(Y1,Y3,Y2,y1,y2,y3); k31=f(X2,X1,X3,x1,x2,x3); k32=f(Y2,Y1,Y3,y1,y2,y3); k41=f(X2,X3,X1,x1,x2,x3); k42=f(Y2,Y3,Y1,y1,y2,y3); k51=f(X3,X1,X2,x1,x2,x3); k52=f(Y3,Y1,Y2,y1,y2,y3); k61=f(X3,X2,X1,x1,x2,x3); k62=f(Y3,Y2,Y1,y1,y2,y3);
ff(ans,k11,k12); ff(ans,k21,k22); ff(ans,k31,k32); ff(ans,k41,k42); ff(ans,k51,k52); ff(ans,k61,k62);
if(ans==30)puts("IMPOSSIBLE"); else printf("%i",ans); return 0; } #include<stdio.h> int f(int X1,int X2,int X3,int x1,int x2,int x3) { if(X1==x1&&X2==x2&&X3==x3)return 0; if(x3+X1==x1+X3&&x3+X1==x2+X2&&(x3+X1)%2==0)return 1; if(x1-X1==x2-X2&&x1-X1==x3-X3&&(x1-X1)%2==0)return 2; return -1; } void ff(int &ans, int &k1, int &k2) { if(k1!=-1&&k2!=-1&&k1+k2<ans)ans=k1+k2; } int main() { int x1,y1,x2,y2,x3,y3,X1,Y1,X2,Y2,X3,Y3,ans=30; scanf("%i %i %i %i %i %i",&x1,&y1,&x2,&y2,&x3,&y3); scanf("%i %i %i %i %i %i",&X1,&Y1,&X2,&Y2,&X3,&Y3); int k11,k12,k21,k22,k31,k32,k41,k42,k51,k52,k61,k62; k11=f(X1,X2,X3,x1,x2,x3); k12=f(Y1,Y2,Y3,y1,y2,y3); k21=f(X1,X3,X2,x1,x2,x3); k22=f(Y1,Y3,Y2,y1,y2,y3); k31=f(X2,X1,X3,x1,x2,x3); k32=f(Y2,Y1,Y3,y1,y2,y3); k41=f(X2,X3,X1,x1,x2,x3); k42=f(Y2,Y3,Y1,y1,y2,y3); k51=f(X3,X1,X2,x1,x2,x3); k52=f(Y3,Y1,Y2,y1,y2,y3); k61=f(X3,X2,X1,x1,x2,x3); k62=f(Y3,Y2,Y1,y1,y2,y3);
ff(ans,k11,k12); ff(ans,k21,k22); ff(ans,k31,k32); ff(ans,k41,k42); ff(ans,k51,k52); ff(ans,k61,k62);
if(ans==30)puts("IMPOSSIBLE"); else printf("%i",ans); return 0; } #include<stdio.h> int f(int X1,int X2,int X3,int x1,int x2,int x3) { if(X1==x1&&X2==x2&&X3==x3)return 0; if(x3+X1==x1+X3&&x3+X1==x2+X2&&(x3+X1)%2==0)return 1; if(x1-X1==x2-X2&&x1-X1==x3-X3&&(x1-X1)%2==0)return 2; return -1; } void ff(int &ans, int &k1, int &k2) { if(k1!=-1&&k2!=-1&&k1+k2<ans)ans=k1+k2; } int main() { int x1,y1,x2,y2,x3,y3,X1,Y1,X2,Y2,X3,Y3,ans=30; scanf("%i %i %i %i %i %i",&x1,&y1,&x2,&y2,&x3,&y3); scanf("%i %i %i %i %i %i",&X1,&Y1,&X2,&Y2,&X3,&Y3); int k11,k12,k21,k22,k31,k32,k41,k42,k51,k52,k61,k62; k11=f(X1,X2,X3,x1,x2,x3); k12=f(Y1,Y2,Y3,y1,y2,y3); k21=f(X1,X3,X2,x1,x2,x3); k22=f(Y1,Y3,Y2,y1,y2,y3); k31=f(X2,X1,X3,x1,x2,x3); k32=f(Y2,Y1,Y3,y1,y2,y3); k41=f(X2,X3,X1,x1,x2,x3); k42=f(Y2,Y3,Y1,y1,y2,y3); k51=f(X3,X1,X2,x1,x2,x3); k52=f(Y3,Y1,Y2,y1,y2,y3); k61=f(X3,X2,X1,x1,x2,x3); k62=f(Y3,Y2,Y1,y1,y2,y3);
ff(ans,k11,k12); ff(ans,k21,k22); ff(ans,k31,k32); ff(ans,k41,k42); ff(ans,k51,k52); ff(ans,k61,k62);
if(ans==30)puts("IMPOSSIBLE"); else printf("%i",ans); return 0; } | | 6 test!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | Dimonka | 1823. Идеальный газ | 13 ноя 2012 16:18 | 2 | if ((p = 0) and (n = 0)) and ((Pc = 1) and (Nc = 1)) then writeln('undefined'); if (((p = 0) and (n <> 0)) or ((p <> 0) and (n = 0)))and ((Pc = 1) and (Nc = 1)) then writeln('error'); this pair if we have on input n and p (Nc = 1 and Pc = 1) but still i have wa on 6 test! are there any conditions for "error" and "undefined"??? please help. i've already sent my solution for 13 times! and still it's wa... Oh, I have the same problem:( | | Compilation Error | Added | 1083. Факториалы!!! | 13 ноя 2012 13:27 | 3 | It works but here i get Compilation Error #include <iostream> using namespace std; int main(){ int num, val, numMod; string nFuc; cin >> num >> nFuc;
int i = nFuc.length();
int mod = num % i; if(mod != 0){ numMod = num; val = numMod; while(numMod != mod){ numMod -= i; val *= numMod; } }
else if(mod == 0){ numMod = num; val = numMod; while(numMod > i){ numMod -= i; val *= numMod; } }
cout << val << endl; } | | Please can someone give me test 7 ??? | esekkelle | 1788. О пользе зонтов | 13 ноя 2012 12:17 | 1 | |
|
|