Common Board| Show all threads Hide all threads Show all messages Hide all messages | | who wants AC in Java use BigInteger | qafqaz Xeyyam | 1224. Spiral | 22 Jun 2010 16:36 | 1 | When I use doubele i got wrong in 12. But after I use BigInteger and got AC. | | Why WA #3? It seems so simple. | Maigo Akisame (maigoakisame@yahoo.com.cn) | 1317. Hail | 22 Jun 2010 03:53 | 3 | program ural1317; const maxn=10; zero=1e-6; var x,y:array[1..maxn+1]of real; n,k,i,ans:longint; h,d,a,b,u,v:real; function cross(xa,ya,xb,yb,xc,yc:real):real; var x1,y1,x2,y2:real; begin x1:=xb-xa;y1:=yb-ya; x2:=xc-xa;y2:=yc-ya; cross:=x1*y2-x2*y1; end; function dist(xa,ya,xb,yb:real):real; begin dist:=sqrt(sqr(xa-xb)+sqr(ya-yb)); end; procedure shoot; var i:byte; l,r:real; begin for i:=1 to n do if cross(a,b,u,v,x[i],y[i])*cross(a,b,u,v,x[i+1],y[i+1])<=0 then begin l:=dist(a,b,u,v); if l<zero then begin inc(ans);exit;end; if d<l then exit; r:=abs(cross(a,b,x[i],y[i],x[i+1],y[i+1]))/dist(x[i],y[i],x[i+1],y[i+1]); if sqrt(d*d-l*l)/l*r>h then inc(ans); exit; end; end; begin read(n,h); for i:=1 to n do read(x[i],y[i]); x[n+1]:=x[1];y[n+1]:=y[1]; read(d,a,b,k); for i:=1 to k do begin readln(u,v); shoot; end; writeln(ans); end. program ural1317; const maxn=10; zero=1e-6; var x,y:array[1..maxn+1]of real; n,k,i,ans:longint; h,d,a,b,u,v:real; function cross(xa,ya,xb,yb,xc,yc:real):real; var x1,y1,x2,y2:real; begin x1:=xb-xa;y1:=yb-ya; x2:=xc-xa;y2:=yc-ya; cross:=x1*y2-x2*y1; end; function dist(xa,ya,xb,yb:real):real; begin dist:=sqrt(sqr(xa-xb)+sqr(ya-yb)); end; procedure shoot; var i:byte; l,r:real; begin for i:=1 to n do if cross(a,b,u,v,x[i],y[i])*cross(a,b,u,v,x[i+1],y[i+1])<=0 then begin l:=dist(a,b,u,v); if l<zero then begin inc(ans);exit;end; if d<l then exit; r:=abs(cross(a,b,x[i],y[i],x[i+1],y[i+1]))/dist(x[i],y[i],x[i+1],y[i+1]); if sqrt(d*d-l*l)/l*r>h then inc(ans); exit; end; end; begin read(n,h); for i:=1 to n do read(x[i],y[i]); x[n+1]:=x[1];y[n+1]:=y[1]; read(d,a,b,k); for i:=1 to k do begin readln(u,v); shoot; end; writeln(ans); end. Your algo to find intersection point is wrong. Use algo to find intersection point of 2 lines with modifications. | | Can't Understand the Problem | Varun Sharma | 1317. Hail | 22 Jun 2010 03:50 | 2 | Hi, How come the answer for the test case is three when all the points 0,0 1,1 2,2 3,3 and 4,4 are within 50 meters of the laser. The answer should be 5 ? isn't it ? Also, what are the roles of fence and convex polygon here ? can't seem to get that as well ! Thanks Laser can't shoot through polygon and height of wall is important. | | Please explain the sample input #2 | yuyan | 1633. Hippogriffs | 22 Jun 2010 02:17 | 2 | Why A1=1 B1=2 A2=2 B2=4 The answer is 5? Please tell me.Thank you. | | WA #49 | Faeton (Kyiv - Mohyla Academy) | 1648. Yachts | 21 Jun 2010 17:05 | 3 | WA #49 Faeton (Kyiv - Mohyla Academy) 9 Nov 2008 20:34 Could anyone give me some tricky tests? Strange: printf with %lld does not work for a long long, while cout does. | | VERY STRANGE !!! COIN CHANGE : MLE 56 OR WA 32 | muhammad | 1635. Mnemonics and Palindromes | 21 Jun 2010 11:05 | 1 | I just find all palindromes. make_pair of starting and ending location of each. store result in vector. then use just coin change algo. It gives MLE 56 when using integers and WA 32 or CRASH 32 when using short. I am crazy about such problem. please anyone let me know what to do. pp: please!!! | | 1133. Is there anybody help me???... I did it but wa3. | Fibo | | 21 Jun 2010 00:16 | 1 | #include <cstdlib> #include <iostream> using namespace std; int bas = -2000000001; int son = 2000000001; int i,n,j,y,t; int Fi, Fj, Fn; int Fibo(int m); int main(int argc, char *argv[]) { int h=0; cin >> i >> Fi >> j >> Fj >> n;
if(i > j){swap(i,j); swap(Fi,Fj);} t=abs(n);y=abs(i); if(n<i && n<0){n=0; i=i+t; j=j+t;} else if(i<0 && i<n) { i=0; n=n+y; j=j+y;}
// cout << i << " " << j <<" " << n; int bas = -2000000001; int son = 2000000001; int m; if(j==i+1) {h=1;m=Fj;} else{
while(bas <=son) { m =(bas +son)/2; if(Fibo(m)==Fj) { break;} else if(Fibo(m)>Fj){ son= m;} else {bas = m ;} }
}
if(n>i){ for(int e=i+1;e<n;e++){ Fn = Fi + m; Fi = m; m=Fn;}cout << Fn;} else if(n==i) cout << Fi; else if(n==j) cout << Fj; else if(n < i) { for(int e=n+1;e<=i;e++){ Fn = m-Fi; m = Fi; Fi = Fn;
} cout << Fn; } return 0; } int Fibo(int m) { int r=m; int fk; fk=Fi; int ans=0; for(int k=i+1; k<j; k++) {ans = fk +r; fk=r; r=ans;} return ans; } | | WA2 | Андрей Шмиг [SKYDOS] | 1226. esreveR redrO | 20 Jun 2010 18:24 | 1 | WA2 Андрей Шмиг [SKYDOS] 20 Jun 2010 18:24 | | Wa 4 | xkszltl | 1557. Network Attack | 19 Jun 2010 09:16 | 1 | Wa 4 xkszltl 19 Jun 2010 09:16 I'm Wa 4,Who can help me?!!! | | WA #29 | Connector | 1354. Palindrome. Again Palindrome | 18 Jun 2010 21:54 | 1 | WA #29 Connector 18 Jun 2010 21:54 Check your vars for type overflow (if KMP check the type of array of pr) | | ship and row's length can be zero | Enzo | 1115. Ships | 18 Jun 2010 19:32 | 1 | but i still can't pass test 10 what's in it? | | Why WA7 ? | Paul | 1647. Divide an Island! | 18 Jun 2010 18:36 | 1 | program Project1; {$APPTYPE CONSOLE} uses SysUtils; type point=record x,y:extended; end; function dist(a,b:point):extended; begin dist:=sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); end; procedure readp(var a:point); begin read(a.x,a.y); end; procedure searchXY(a,b,c:extended; var x,y:extended); var p:extended; begin p:=(a+b+c)/2; if p*p-2*a*b<0 then begin x:=maxlongint; y:=maxlongint; exit; end; x:=(p+sqrt(p*p-2*a*b))/2; y:=(p-sqrt(p*p-2*a*b))/2; end; var A,B,C:point; aa,bb,cc,x,y:extended; flagg:integer; procedure print(a:point; x:extended; b:point; y:extended; c:point); var CA,CB:point; begin CA.x:=a.x-c.x; CA.y:=a.y-c.y; CB.x:=b.x-c.x; CB.y:=b.y-c.y; if (x/dist(a,c)*CA.x=y/dist(b,c)*CB.x)and(x/dist(a,c)*CA.y=y/dist(b,c)*CB.y) then begin flagg:=1; exit; end; writeln(x/dist(a,c)*CA.x+c.x:0:9,' ',x/dist(a,c)*CA.y+c.y:0:9); writeln(y/dist(b,c)*CB.x+c.x:0:9,' ',y/dist(b,c)*CB.y+c.y:0:9); end; begin readp(A); readp(B); readp(C); aa:=dist(B,C); bb:=dist(A,C); cc:=dist(A,B); searchXY(aa,bb,cc,x,y); flagg:=0; if (x<aa)and(y<bb)and(x<>maxlongint) then begin writeln('YES'); print(b,x,a,y,c); if flagg=0 then halt; end; flagg:=0; if (x<bb)and(y<aa)and(x<>maxlongint) then begin writeln('YES'); print(a,x,b,y,c); if flagg=0 then halt; end; searchXY(aa,cc,bb,x,y); flagg:=0; if (x<aa)and(y<cc)and(x<>maxlongint) then begin writeln('YES'); print(c,x,a,y,b); if flagg=0 then halt; end; flagg:=0; if (x<cc)and(y<aa)and(x<>maxlongint) then begin writeln('YES'); print(a,x,c,y,b); if flagg=0 then halt; end; flagg:=0; searchXY(bb,cc,aa,x,y); if (x<bb)and(y<cc)and(x<>maxlongint) then begin writeln('YES'); print(c,x,b,y,a); if flagg=0 then halt; end; flagg:=0; if (x<cc)and(y<bb)and(x<>maxlongint) then begin writeln('YES'); print(b,x,c,y,a); if flagg=0 then halt; end; writeln('NO'); end. I know that it's "bugcode", but.. | | On this OJ, the "Time Limit" is for every case or total? Thanks. | 3xian | | 18 Jun 2010 17:58 | 1 | | | Is there non-greedy solution? | VNTU Vitaly(Traning) | 1092. Transversal | 17 Jun 2010 03:59 | 4 | I founded some non-greedy solution :) O(N^4) As far as I remember I solved it by math. My algo is likely to be O(N^3). can you briefly describe what you did? i could solve it only with greedy approach... | | help me!!! What is 4th test? | Ezio - Altair | 1617. Flat Spots | 16 Jun 2010 23:21 | 2 | help me!!! What is 4th test? I got Ac help me!!! What is 4th test? | | help me!!! What is 4th test? | Ezio - Altair | 1617. Flat Spots | 16 Jun 2010 18:48 | 1 | | | Who can add some tests here for this problem. | Ezio - Altair | 1617. Flat Spots | 16 Jun 2010 17:12 | 1 | Who can add some tests here for this problem. | | What is a 3-rd test?. Help | Ezio - Altair | 1617. Flat Spots | 16 Jun 2010 17:11 | 1 | What is a 3-rd test?. Help | | WA test 8 | Henrique | 1588. Jamaica | 16 Jun 2010 00:20 | 2 | plz help me, i got WA on this test , if someone knows this one help me!. I think it's a test like: 3 0 0 0 3 0 2 and I just adjust my program | | please send me a solution | zie7lak | 1712. Cipher Grille | 15 Jun 2010 00:16 | 1 | my e-mail is griszka90@wp.pl |
|
|