Common BoardPlease, someboby help me and give me some tests! i mean if: AB<=BC or <ACB=90' or <BAC>90' then YES miss something? if <BAC>90' then AB<=BC is always true Edited by author 22.04.2009 19:34 Edited by author 22.04.2009 19:34 (AB<=BC) || (BCA==90) || (BAC>=90) verify in int and if No 1001 ways for approximating calculations after PS: It is possible to make mistake about ==90 ABC==90 - May be! and it is test 26 Some time I was under influence of the fact that in 90-triangles for equality is enought 2 elements. Also it is interesting that special cases should verified under integer considerations all times because numeric methods are bad near this cases due big error multiplicators. Edited by author 31.05.2009 09:41 Where do the intervals start from? And why doesn't it matter the legth of the tram travels? I mean, it must matter for the interval of the trams....... Explain PLZ any time the robber come to the i-th stop, he have to wait for ti (time interval) minutes ,a tram will come and the interval starts. most of problems in this contest are very ambigious, i had to guest many times to know what they want. please explain me about 1190 First, 10x about the explanation. I'll try to solve it having that in mind. About 1190-> I had problems with understanding it, too. Maybe you should read the comments on board 1190. Some people helped me there. You should have these in mind : 0) Percents should be non-increasing, not strictly decreasing 1) Names contain no intervals 2) Try both the possiblities-> the maximum one and the minimum one. If the maximum is less than 10000, then NO. If the minimum is more than 10000 than NO again. If the percents are not non-increasing-> NO. Otherwise-> YES. You should get AC with that. and what about the policeman? does he have to wait ti as well? Because, if the counting for him starts with the arrival of the robber at the tram stop, then it DOES matter the length of the route... So, does the policeman have to wait ti minutes as well? Another question-> If the distance (the lag-> L) is 2, and t1 is 2, does the policeman catch the robber 15 4 7 3 13 6 1st stop robber is here at time 0 and he go out when time 0+7 police is here at time 15 the next tram will come at time 21 (trams come at 7,14,21) the length of route doesn't matter the time lag at all because their speed are always equal. so i'll assume that it's 0. 2nd stop robber arrive at 7 robber go 7+3=10 police arrive 21 police go 22 (10,13,16,19,22) 3rd stop robber go 10+13 = 23 police come 22 and arrest the robber here before he can go #include <stdio.h> int main() { int cop,n,ti,rob,i,st,ost,tmp; scanf("%d %d",&cop,&n); for (i=1;i<=n;i++) { scanf("%d",&ti); st=rob; rob+=ti; if (rob>=cop) { printf("YES\n"); return 0; } st=cop-st; ost=st%ti; if (ost==0) ost=ti; cop+=(ti-ost); } printf("NO\n"); return 0; } I tried with if (rob>cop) but I got WA. I tried to compare the leaving times(i mean, compare the time when the cop catches the tram and the time the robber catches the tram, and if they are the same or the cop can catch an earlier tram, then YES... but WA too. What I do is just implementing stepwisely what you told me-> in 'cop' i keep the time of the cop, and in 'rob' the time of the robber... But WA. Help plz? > #include <stdio.h> > > int main() { > int cop,n,ti,rob,i,st,ost,tmp; > scanf("%d %d",&cop,&n); > for (i=1;i<=n;i++) { > scanf("%d",&ti); > st=rob; > rob+=ti; > if (rob>=cop) { > printf("YES\n"); > return 0; > } > st=cop-st; > ost=st%ti; > if (ost==0) ost=ti; > cop+=(ti-ost); > } > printf("NO\n"); > return 0; > } 1.) initialize the variable rob to be 0! 2.) problem statement says "the policeman will have luck to overtake the robber. For instance, if L *****<***** K1, then it may happen that the policeman will reach the first stop, when the robber is still waiting for the tram there." this implies that , if police reach the stop when the robber is leaving , he just have to wait from the next tram. so use condition "rob>cop" and comment "if (ost==0) ost=ti;" and you'll get AC! I don't think the statement is clearly, it may mislead someone like me... #include <cstdlib> #include <iostream> #include <math.h> #include <iomanip>> using namespace std; double *qntd = NULL; short n,i; int main(int argc, char *argv[]) { cin >> n; qntd = new double [n];
for (i = 0; i < n; i++) { cin >> qntd[i]; } for (i = n-1;i > -1; i--) { cout << setprecision(4)<<fixed << sqrt(qntd[i]) <<'\n'; }
system("PAUSE"); return EXIT_SUCCESS; } //#include <cstdlib> //superfluous library #include <iostream> #include <math.h> #include <iomanip> using namespace std; double *qntd = NULL; int /*n,*/i=0; //cin is stream (no n) //short is too short int main(int argc, char *argv[]){ // cin >> n; qntd = new double [256*1024]; //memory 256KB /* for (i = 0; i < n; i++) //cin is stream (no n) { cin >> qntd[i]; } */ while(cin>>qntd[i++]); for (i-=2;i>=0;i--) cout << setprecision(4)<<fixed << sqrt(qntd[i]) << endl; system("PAUSE"); return EXIT_SUCCESS; } Edited by author 28.05.2009 20:14 Let image graph where every number is vertex, then we can add edge from a to b if a+SQ=b (where SQ - some square). Now you can see graph, there maximum 60000 vertex and maximum ~ 60000*300 = 18 000 000 edges, out task is find way from 0 to given number. BFS will done this in O(N+M) this task is easy to solve O(N) time ;) 1:) Is it actually only (n-1) robots? (One for the accountant) 2:) What's the salary arrangement of the first 6 months in the sample? 3:) Is p always larger than the answer? What if not? 4:) What's the answer for the test 4 3 100? Thanks for answering. Somebody please answer these questions. I don't understand the problem. My program passed the tests I could find but got WA#6. Please, give me a hint what the test #6 is!! My #6 was TLE.I don't know the reason too. I also had WA#6, but i understood problem very fast. If you use DP, you should save results for every vertex in the array, and return this value if there is the same query in the future. This is full DP and it works fast. Me too, i tried many tests but still DON'T KNOW WHY...... Edited by author 28.05.2009 14:26 I want to contact my friend,But I don't know how to send it. It's really a pity. Please give me some help. a test or smth. I passed test 3 when changed Heron formula to vector product. THIS OUR PROGRAMM: program magician; {$APPTYPE CONSOLE} uses SysUtils; Var i,j,n,m,k,t:integer; a:array[1..10000] of integer; begin readln(n,m); for i:=1 to n do readln(a[i]); if(m>n) then m:=m mod n; t:=0; i:=m; repeat i:=i+1; t:=t+1; write(a[i]); if i=n then i:=0; until t=10; end. Maybe you should input(n=12,m=12)to check your error. I have a solution with O(m * log(m) * log(m) * log(n) ). Does anybody can describe a TL test? Thanks, I've found it... And I have AC! I got WA on test#10 But I can't find out what's wrong with my code. Can you give me some tests? Thanks a lot. Here is the test 1 0 -1 0 0 1.73205080756 3 0 1 0 2 1.73205080756 The answer is 1 -2.0000000000 0.00000000000 Oh!Thank you very much! I got AC now! The sample input is weak. You have to read problem statement more carefully, quite the opposite of what I did :) "...It is unknown by whom and in which order the weights were put, but after putting each weight on the balance a record was made on a sheet of paper: if the left pan outweighed, then the letter L was written; if the right pan outweighed, then the letter R was written;..." Edited by author 29.05.2009 13:30 type arr=array[1..15000]of longint; var sum,i,j,n,m,x1:longint; a:arr; procedure search(var f:arr;x,p,q:longint;var sum:longint); var c:integer; begin c:=(p+q)div 2; if p>q then exit; if x=f[c] then inc(sum) else if x>f[c] then search(f,x,c+1,q,sum) else search(f,x,p,c-1,sum); end; begin readln(n);sum:=0; for i:=1 to n do readln(a[i]); readln(m); for i:=1 to m do begin readln(x1); search(a,x1,1,n,sum); end; write(sum); end. I know an idea how to solve it, but I need to rotate a vector in a definite plane. I'm no so good in 3D-geometry yet, so I would appreciate any advice how to do it efficiently. Maybe someone could give me a link to an appropriate article... Edited by author 03.05.2009 22:12 This was very simple problem for me because I could find 1. formula for distance in 3D from point to line 2. formula for rotation matrix with given line. All information in Wicpedia articles. 3. formula for projection point to line in 3D -at the same place. Also I known cosine theorem in advance. "No solution" I proved in __int64 manner and was right. But problem about Ostap I can not to solve. This is potential theory problem and I try to use union-find methods but unsuccessfully. Edited by author 25.05.2009 11:47 I've found simplier solution, which calculates the coordinates of required point in 2D, then just changes the basis. Now about Ostap)) I've used an algo based on disjoint sets. For every workman I store the difference between his and his ancestor wages. And for every set I store the minimum such difference to check conditions efficiently. Сделайте нормальный человеческий перевод. Ну невозможно читать этот бред. "Are different the lightsaber, and Jedi different are" - вот как это понять, или " If looses a Jedi, must leave the tournament he." - лучше условие на русском сделайте, чем бредовое английское. Then, maybe, not Jedi English, but Yoda English =) How many moves do I need to change places of + and =? 4? First I save the data like that: f:array[1..500,1..20]of string[8]; It is Wa 10 Next,I change the way: f:array[1..500,1..100]of string[10]; Then I AC!!! I hope that can help you!!! f[1..500,1..80] is enough. But I still WA on #8 ... Is it 2831? Yes,you are right! Oh!Thank you very much.I got AC now! By the way,if someone have WA on TEST#14 Please try K=14 , the answer is 13! |
|