Common Boardvar a:array[1..1000000] of int64; i,j:longint; begin {$IFNDEF ONLINE_JUDGE} assign(input,'input.txt'); reset(input); assign(output,'output.txt'); rewrite(output); {$ENDIF} i:=0; while not seekeof do begin inc(i); read(a[i]); end; for j:=i downto 1 do writeln(sqrt(a[j]):0:4); {$IFNDEF ONLINE_JUDGE} close(input); close(output); {$ENDIF} readln; end. my solution is the same but it gets WA#1 :) Thanks a lot! Accepted!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TYPE node=^Tnode; Tnode=Record data:Extended; next:node; END; VAR n:Qword; k:Extended; list,temp:node; BEGIN new(list); list^.next:=nil; while not seekeof do BEGIN read(n); k:=sqrt(n); new(temp); temp^.data:=k; temp^.next:=list^.next; list^.next:=temp; END; while list^.next<>nil do BEGIN writeln(list^.next^.data:0:4); list^.next:=list^.next^.next; END; END. I wonder, too! Can you provide at least one 'hard' case? Is it a large number which should give 1, but somehow gives 0? EDIT: Yes, it is, got AC after all. Edited by author 01.03.2008 01:34 I got WA #3 too, could you help me ? My decision: 1.) We consider polygon such what it is, we spend 2 straight linees in parallel OX, one passes through the lowermost point, another through the uppermost. We spend a third - a line of a break on middle between a theme to two. We look at fragments. If the area of the top fragment is more, then we lift a line of a break on 1/4 all intervals, else is lowered. Then shift on 1/8 etc. To put it briefly, binary search we find height of a horizontal that it divided into equal fragments. 2.) We turn a figure, concerning any fixed point on a small corner (about 0.01 radian) 3.) We carry out action number 1. And so we shall consider all possible variants. Certainly sooner or later it is necessary to stop to rotate a figure. It at turn on 180 degrees from an initial arrangement of a figure. My decision works for 0.078 seconds and 253 Kb. What your thunk about it? GOOD LUCK! I am sorry for bad English My solution differs from yours one, but I think your idea is interesting. I've solved it in a classical way using 2 binary searches - the first one inside the second, and then just a constants optimization... Thank for good words :-) Can you explain your method for me? You know my email. Edited by author 21.06.2004 23:05 Edited by author 20.08.2008 20:22 I used similar idea and checked 10000 angles, but had wa10. Then I replaced it into 1000 and got AC. Now i'm wonder why, it seems to me accuracy lowered then. WA#5 help. sorry for my poor english Edited by author 25.03.2009 10:19 Sorry for the offtop, but still... To the situation nowadays, I can only praise my colleagues and myself for the problem statement that remains actual despite three years passed since the contest was held. Long life this problem! :) "You should right a program that helps scientists get rid of troubleduons." => "You should write a program that helps scientists get rid of troubleduons." Is there any good method other than precalculating and using the values stored? I've got a good method. Use the following recurrence eqn and solve using DP. num(n,s)=sigma(i=0 to 9){ ((s-i)>=0)?num(n-1, s-i):0} n represents the number of digits and s represents the sum of digits. NOTE: For those who got WA#9, you would not have initialized num[1][9]=1. Better checkout the whole 2d array once and verify that for s=81 output should be 1. Edited by author 15.02.2008 00:14 I initialized num[1][9]=1 and i have AC so sorry for taking an admins' expensive time, its my bug. i fix it & i got ac. TU Edited by author 08.01.2009 12:27 #include <iostream> using namespace std; int main() { long long n,a[65550],i,k=1,b=1; cin>>n; for(i=0; i<n; i++) { cin>>a[i]; k=1; b=1; while(k<=a[i]) { b+=k; k++; } if(b==a[i]) cout<<1<<" '; else cout<<0<<" "; } return 0; } In your example order of words in dictionary is same with order of outputing words, but in the problem's text there is no words about it. Fix it , please. Did anybody try to solve this problem via "splay trees" (self-organizing trees by Sleator)? Randomized trees and treaps easily accepted, but now I'am interested in splay trees and always TL :( In test 17 point A is equal to point B. Is it correct? In problem statement "a line segment with the ends A and B". I think that one point is _not_ a line segment. excuse my english first. i tried my program on a lot of examples of mine and it's ok. but i got for 10 times WA on the test #4...why? can anybody tell me what's about or give me some hint for this problem? thx all if s1 is palindrome 。。 s2 cat't be a empty sequence! :D
Tam mnogo otvetov Na ety temy Sidi 4itai!!!! Try this test abbaa Answer is abbaabba - center of palindrome can be between chars! Edited by author 04.01.2009 20:00 Edited by author 04.01.2009 19:59 it seems that my program has no bug. it pass all test on board and all my tests. I bicolored graph. then used DP to find answer but I got WA3. *** I have found mistake. AC now! this test helped me very much: 50 2 99 100 98 99 Edited by author 25.02.2007 19:13 This test is really helpful to me. Thx a lot. thanks:) ((( my DP get WA3 but brute force get AC There is no testdata like this! I didn't Consider it and ACed now. So I think the problem number is in [1,2n] For all those who got WA#3 with dfs and DP, The case given here didn't help me but 2 1 1 3 helped me. Notice that when you are selecting whether white part is to be selected or black part, and pushing the result in a vector or queue, due to DP, last part gets inserted first. So you have to consider that first result in the vector/queue is for the last pair of partition. May be this will help... Edited by author 04.01.2009 19:08 Edited by author 04.01.2009 19:08 1 2 2 3 3 1 1 10 in this test , i do not know why ? what about the others vertex ? 4,5,6,7,8,9 ?? "Imagine graph drawn on a wall. Select any vertex and erase exactly two edges incidental to this vertex. The question of problem is: "Is it possible to erase all edges of graph doing in this way?"" think again: 1 2 2 3 3 1 1 10 you will understand.... void Readinp() { int x,y; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); while (cin >> x >>y) { a[x][y]=1; a[y][x]=1; b[x]++; b[y]++; n=max(n,max(x,y)); } } #include <iostream> using namespace std; int step(int, int); int main() { int n,m,y,i,s=0,f=-1; cin>>n>>m>>y; for(i=0; i<m; i++) if(step(i,n)%m==y) { cout<<i<<" "; s++; } if(s==0) cout<<f; return 0; } int step(int x, int n) { int i,p=1; for(i=0; i<n; i++) p*=x; return p; } |
|