Общий форумI spent 20 submissions, because of TLE15. I tried many fft implementations. But the error was in my z function In a task it is told that a way of departure (1; 1) though, actually, the way of departure has to be (0; 0) Nop, he is starting out from the south-west corner of the 1;1 quarter Isn't that the same as 0;0? My bee had to make only 200 flights, if you know what I mean :) 100 flights wasn't enough to get AC n = int(input()) sp = [] c = 0 for i in range(n): b = input() sp.append(b) sp.sort() for i in sp: if sp.count(i) >= 2 and c == 0: print(i) c = 1 if sp.count(i) < 2: c = 0 Pascal var a,b: array[1..100] of string; i,j,k,n: integer; s: string; f: boolean; begin readln(n); for i:=1 to n do begin readln(s); f:=false; for j:=1 to n do if a[j] = s then f:=true; if f = false then a[i]:=s else begin f:=false; for j:=1 to n div 2 do if b[j] = s then f:=true; if f = false then b[i]:=s; end; end; for i:=1 to n div 2 do if b[i] <> '' then writeln(b[i]);
end. please can anyone give me test #13? oh i found the test 9 000123000 --------- 123000000143 (my program) no good epsilon for this problem use big integers. The first day has no delay flight from the day before. 2 1 60 100 23:00 He can departure from 24:00 , not 00:00 Using long long hashes, any ideas? brute-force solution with bitsets gets AC in 0.187 sec I've solved this problem finally, of course, but I still suppose its definition to be unclear a bit :) So some tests for you: 1 3 1 1 1 1 // 1 5 1 2 3 4 5 // 1 5 5 4 3 3 3 1 // 1 7 1 2 2 3 3 4 5 1 // 1 5 1 2 3 2 1 2 // 1 6 1 2 3 2 3 4 2 - that's the point! // 1 6 3 2 1 4 4 5 2 // 1 6 1 2 1 2 1 2 3 // 1 6 1 2 3 1 2 1 3 Thank you. I've solved this problem finally too. The problem statement is quite ambiguous. Thank you for clarification. Thank you for tests! Who has problem with test 9 - use test 1 12 1 2 3 3 2 1 1 2 3 4 5 4 Answer - 4 Thanks! Problem statement really lacks definition for flat slopes... Thanks! Если честно, то условие ваще дурацкое. >> 1 6 1 2 3 2 3 4 2 - that's the point! >> Why so? =( I know, that problem of my solution in this but don't understand.. I think it should be 3. cause it can be divided in (1,2,3) and (2,3,4) > 1 6 > 1 2 3 2 3 4 Well, I see, it can be divided into (1, 2, 3) and (2, 3, 4). But I don't see anything in the statement, that restricts me to divide into (1, 2), (3, 2), (3, 4). Does this mean, that complexity should be minimal? Then why cant it be divided into (1,2) , (3,2) , (3) , (4) ? Because (1,2) , (3,2) , (3) , (4) = complexity 4 is not optimal Less complexity is: (1,2) , (3,2) , (3,4) = complexity 3 Optimal is: (1,2,3) , (2,3,4) = complexity 2 It is not necessary to connect point #3 and point #4 Hi! 1 3 2 10 5 ->2 * 1 5 20 20 200 20 200 ->2 * 1 5 1 2 2 1 1 ->2 * This test helped me to overcome WA21: input: 1 7 2 2 1 2 2 1 2 output: 3 Thanks for the test cases. Agreed. The problem is easy, but the sample I/O is very misleading. Can this problem be solved in python? Can't pass test 39 "The second line contains n different positive integers, which are less than the L", That's result translated from RUS version. But the ENG version has not the word "positive". Please can you take a look? Do not believe the simplicity of the task at first glance. This is NOT a geometry problem. This is a "precision" problem. Also, I misunderstood problem a little. If the second point is in front of mirror, but can not be seen in it, it is INVISIBLE. It is checked in test 5. Input 7 2 5 3 1 3 4 4 Output INVISIBLE my simple dp solution got tle 17. after optimizing with bin_search and map (for searching if a range of edges already visited) but surprisingly this got me wa 17. please, help. some useful test cases or hint would be really appreciated. Thanks in advance :) Edited by author 30.03.2012 22:05 got AC but shouldn't have. i used map to keep mark upto what edges outgoing from a certain node we have already dp'ed. and return in log(n). but when i have to dp more then dp'ed and entered into map for that node. however, this gave wa 17. then i dp'ed some more node although already dp'ed. if this 'some more' is less than 9 then i get wa on (18~23) tests. but when it is >=9 i get AC. i dunno why my soln was WA, it seemed perfect. but even more surprising when i get AC like this. Portion of my code:- #define WHATTHEHECK 9 ... map<int,double> optimize[MAX]; ... int lim1=arr[edgeno].dtime+arr[edgeno].dur,lim2=lim1+arr[edgeno].delay; int s1=v[to].size(),s2=s1; int lo=0,hi=s1-1,mid; while(lo<=hi){ mid=(lo+hi)/2; if(lim1<=arr[v[to][mid]].dtime){ hi=mid-1,s1=mid; }else lo=mid+1; } lo=0,hi=s2-1; while(lo<=hi){ mid=(lo+hi)/2; if(lim2<=arr[v[to][mid]].dtime){ hi=mid-1,s2=mid; }else lo=mid+1; } int i=-1; if(optimize[to].size()==0) i=v[to].size()-1; else i=min((*optimize[to].begin()).first+WHATTHEHECK,v[to].size()-1); if(i>=s1){ for(;i>=s1;--i){ optimize[to][i]=ret1=min(ret1,dp(v[to][i])); } } if(s1<v[to].size()) ret1=optimize[to][s1]; if(s2<v[to].size()) ret2=optimize[to][s2]; ps: i would be really glad if someone explain me what i did wrong and what's going on here :) I got WA17 when I wrongly (overwrite old mean) insert into segment tree flights with same departure airport and same departure time. 1 0 0 1 2 2 0 -1 1 0 3 3 3 2 -1 0 1 1 0 2 4 2 0 0 5 3 0 2 3 3 0 0 6 -1 0 5 5 0 1 5 4 0 0 5 10 10 5 10 0 5 0 10 5 6 8 0 0 1 2 0 1 4 0 1 4 2 1 4 4 1 2 4 1 0 4 1 0 2 1 10 2 1 1 5 1 1 5 2 3 0 -5 6 0 0 2 0 0 4 6 i couldn't understand, why my programm got Runtime error 15. When i increased MAXN from 1e4 + 10 to 1e5 + 10, i got AC. So the vertices number are in the range [1, 1e5], but not in [1, 1e4], as written in the statement Как понять когда она завершила ввод сообщения? Please use english. I translated your question with google translate and it said "How do you know when it has completed writing a message?". Well, it depends on the programming language you are using. Pascal: while not(eof(input)) (not sure if it was input) C: you usualy use while(!feof(stdin)) http://www.cplusplus.com/reference/cstdio/feof/ This doesn't seem to work (for me at least). C++: I think it's !cin.eof() (I've never used this one). > C: you usualy use while(!feof(stdin)) http://www.cplusplus.com/reference/cstdio/feof/> This doesn't seem to work (for me at least). This does not work if you read lines with gets and write it with puts, but feof(stdin) is works fine. May be some problems with linefeeds. Stupid MSVS. Edited by author 07.02.2013 12:20 Edited by author 07.02.2013 12:20on pascal
while not eoln do begin read(g_string); ...... ...... end; on java: Scanner scan = new Scanner(System.in); while (scan.hasNext()){ s = scan.nextLine(); } on python message = sys.stdin.readlines() and then ctrl+D to stop input don't round up. or you will get wa8. Edited by author 28.05.2023 19:05 I'll just combine two previous hints. Use bubble sort and THEN use random. Use bubble sort and THEN assert that the balls are the same color in (n / 2) and (n / 2 + 1) |
|