Common Board| Show all threads Hide all threads Show all messages Hide all messages | | WA#30 -> WA#25 | Integrator Kash | 1919. Titan Ruins: Transformation of Cylinders | 16 Nov 2012 15:15 | 2 | May I to bend the cut cylinder? Errors of calculations - reason of mistakes :) | | Неверный ответ на первом тесте... | RelaXes[Barnaul] | 1083. Factorials!!! | 16 Nov 2012 11:44 | 3 | 9 !! - ввод 945 - вывод пишет wrong answer var n,i:integer; res:longint; k:string; begin read(n,k); i:=0; res:=1; if n mod length(k)=0 then repeat res:=res*(n-i); inc(i,length(k)); until n-i=length(k) else repeat res:=res*(n-i); inc(i,length(k)); until n-i=1; writeln(res); end. mne toje takoy: --------------------- var x,s:string; s1,j,i,c,l:longint; begin read(x); repeat i:=i+1; s:=s+x[i]; until x[i]=' '; l:=length(x)-i; val(s,s1,c); j:=s1; repeat j:=j-l; s1:=s1*j; until j<=1; write(s1); end. | | How this : "orthography, we get gtorhoprahy",I can't understand | Pegasus | 1685. Orthography | 15 Nov 2012 19:53 | 1 | | | Memory limit | Bohdan Holyshevskyi | 1713. Key Substrings | 15 Nov 2012 13:51 | 1 | On submission 4620967 a have verdict MemoryLimit, but used memory is 8954KB. | | why WA1!!! Please help!! | The Dragon Warrior | 1787. Turn for MEGA | 15 Nov 2012 12:39 | 1 | #include<iostream> using namespace std; int main() { int k,n,a[1001],i,j=0,ans[1001]={0},sum; cin>>k>>n; for(i=0;i<n;i++) {cin>>a[i];} for(i=0;i<n;i++) { if((ans[i-1]+a[i])-k<=0){ans[i]=0;} else if((ans[i-1]+a[i])-k<=0 and ans[i-1]>0){ans[i]=k-a[i]+ans[i-1];} else if((ans[i-1]+a[i])-k>0 and ans[i-1]>0) {ans[i]=a[i]+ans[i-1]-k;} else if((ans[i-1]+a[i])-k>0 and ans[i-1]==0){ans[i]=a[i]-k;} }
cout<<ans[n-1]<<endl; system("pause"); return 0;} Edited by author 15.11.2012 12:40 | | Could you give me some tests??? I have WA#1!!! PLEASE!!!!! | BOyKA | 1167. Bicolored Horses | 15 Nov 2012 12:07 | 1 | | | Some In & Out | daftcoder [Yaroslavl SU] | 1377. Lara Croft | 15 Nov 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. Triangle Game 2 | 15 Nov 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. Workdays | 14 Nov 2012 23:37 | 2 | | | I had WA14 but... | MOPDOBOPOT (USU) | 1133. Fibonacci Sequence | 14 Nov 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. Good Gnusmas – Dead Gnusmas | 14 Nov 2012 21:27 | 5 | WA#9 RASTA 18 Mar 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 Nov 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 Nov 2012 19:13 | 1 | WA#11 ROHAN GULATI 14 Nov 2012 19:13 Please can anybody tell me what is test case #11 | | k(11) = 55, k(13) = 78? | SpBerkut | 1744. The Captain's Squad | 14 Nov 2012 15:53 | 1 | | | Maybe an interesting idea to solve this | Doctor Lai | 1915. Titan Ruins: Reconstruction of Bygones | 14 Nov 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 Nov 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. Sum of Sequential Numbers | 14 Nov 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. Palindrome | 13 Nov 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 Nov 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. Death Star | 13 Nov 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. Guns for Battle! | 13 Nov 2012 18:23 | 1 | |
|
|