Общий форумDo not forget that you should compare solved tasks as ints, not as strings :) Use list to make the adjacency list and not vector. i got this on test 08. Does anyone know the test? Use matrix multiplication (an+1,an)T=M(an,an-1)T I got accepted in 0.78s using scanf instead of cin which makes me TLE I disagree with the result in example 2 to the task 1493. According to the problem, must output "Yes", because 445219 in the summation of the digits gives 13 and 12. These numbers differ by 1. The example says "No". When checking the solution 2, the test system writes "Wrong answer". Please fix the problem or explain me the condition. You are asked to answer IF THE PREVIOUS OR THE NEXT TICKETS ARE LUCKY, NOT IF THE SUMS OF DIGITS DIFFER BY 1. I have two ACCEPTED solution that gives different results (difference greater than 1E-5) in approximately 7.5-8% points. Is this normal? :) If you have access: "Correct" solution: http://acm.timus.ru/getsubmit.aspx/6557034.cppWrong solution: http://acm.timus.ru/getsubmit.aspx/6554840.cpp Here some of this points: -5.4 -4.0 -0.0 -4.0 5.4 -4.0 -5.4 -2.8 -2.7 -2.8 -2.4 -2.8 -2.1 -2.8 -0.6 -2.8 0.6 -2.8 2.1 -2.8 2.4 -2.8 2.7 -2.8 5.4 -2.8 -2.7 -2.5 -0.6 -2.5 0.6 -2.5 2.7 -2.5 -2.7 -2.2 2.7 -2.2 -5.1 -1.9 -4.8 -1.9 -1.8 -1.9 -0.3 -1.9 0.3 -1.9 1.8 -1.9 4.8 -1.9 5.1 -1.9 -4.2 -0.7 -2.7 -0.7 2.7 -0.7 4.2 -0.7 -1.8 -0.4 1.8 -0.4 -1.8 -0.1 1.8 -0.1 -1.8 0.2 1.8 0.2 -4.2 0.5 -2.1 0.5 -1.8 0.5 1.8 0.5 2.1 0.5 4.2 0.5 -4.2 0.8 4.2 0.8 -4.2 1.7 4.2 1.7 -5.1 2.0 5.1 2.0 -2.7 2.3 2.7 2.3 -5.4 2.6 -2.7 2.6 -2.4 2.6 -0.6 2.6 0.6 2.6 2.4 2.6 2.7 2.6 5.4 2.6 -5.4 2.9 -2.7 2.9 -2.4 2.9 -2.1 2.9 -0.6 2.9 0.6 2.9 2.1 2.9 2.4 2.9 2.7 2.9 5.4 2.9 New anti-greedy tests were added. 93 authors lost AC. If you still have AC with greedy solution, please, tell us about it here or to timus_support(at)acm.timus.ru. Also accepted O(n^4) in Go 0.312 As task marked easy, it was lazy for me to implement O(n^3) What is the answer for the test case 6 1 3 2 5 4 6 27 why not 29 ? Mine is also 29 I m getting WA#5 with my code +1 Do u have any clue what is test case 5? What's 5 test? Give me this test, please. Edited by author 10.11.2012 14:59 Can we replace places of the bats 29? 27. You can replace the bat. What's 11 test? Give me this test, please. Edited by author 24.04.2013 22:50 Admins, please add these tests: 0.683013 0.2 0.683013 0.3 0.583013 0.4 0.583013 0.5 Just add them :) I know this might sound stupid, but how am I supposed to know when I've finished inputting numbers? I don't see anything saying what A is equal to, so how do I know? read FAQ. for C++: double n; while (scanf("%lf", &n) != EOF) { ... } I have the same question. What about Java? there's no answer to that in FAQ. You'll know the input has ended when one of the following happens, depending on the method you choose to read in the first place : InputStreamReader in; while(in.read() != -1) BufferedReader in; while((line = in.readLine()) != null) You'll know the input has ended when one of the following happens, depending on the method you choose to read in the first place : InputStreamReader in; while(in.read() != -1) BufferedReader in; while((line = in.readLine()) != null) How to make the EOF? I mean how does it know when the user stopped inputting? As for C#, you can use (as an example): string[] inputValues = Console.In.ReadToEnd().Split(new char[] {' ', '\t', '\n', '\r'}, StringSplitOptions.RemoveEmptyEntries); For windows command prompt CTRL Z would be interpreted as EOF For linux terminal Ctrl + d is the EOF character. /// Edited by author 02.02.2013 14:58 Edited by author 02.02.2013 14:58 I have same prblm in c. I have the same problem with Go. Can someone help me. He guys if you can't come up with any formula...pre-computation will do the job.I could not come up with any formula so I used precomputation and AC in 0.015 sec.Good luck :) My code: var a:array[1..1000]of string; b:array[1..1000]of integer; n,i,j,m,max:integer; s:string; c:boolean; begin readln(n); for i:=1 to n do begin c:=true; readln(s); for j:=1 to m do if s=a[j] then begin inc(b[j]); c:=false; break; end; if c then begin inc(m); a[m]:=s; inc(b[m]); end; end; for i:=1 to n do if max<b[i] then max:=b[i]; writeln(max); end. I know. I understood that the wrong.^^ Sorry to blunt, but I don't understand the meaning of the task. Explain what needs to be done. Examples of chewing the tasks: abaa 1. i = 1, j = 1, k = 2; ' a ' and ' b ' palindromes 2. i = 1, j = 3, k = 4; ' aba ' and ' a ' palindromes 3. i = 2, j = 2, k = 3; ' b ' and ' a ' palindromes 4. i = 2, j = 2, k = 4; ' b ' and ' aa ' palindromes 5. i = 3, j = 3, k = 4; ' a ' and ' a ' palindromes Russian text: Разжевывание примера из задачи: abaa 1. i=1, j=1, k=2; 'a' и 'b' палиндромы 2. i=1, j=3, k=4; 'aba' и 'a' палиндромы 3. i=2, j=2, k=3; 'b' и 'a' палиндромы 4. i=2, j=2, k=4; 'b' и 'aa' палиндромы 5. i=3, j=3, k=4; 'a' и 'a' палиндромы you can use Manacher's algorithm. #include <cstdio> #include <map> std:: map <int, int> a; int n, m, q, i, x, ans; void solve(){ scanf("%d", &n); for(i = 0 ; i < n ; i ++) scanf("%d", &x), a[x] ++; scanf("%d", &m); for(i = 0 ; i < m ; i ++){ scanf("%d", &q); if(a[q]) ans ++; } printf("%d", ans); } int main(){ solve(); } #include <cstdio> #include <algorithm> int a[15051]; int n, m, q, i; int ans; int binary(){ int left = 0, right = n-1, middle; while(left <= right){ middle = (left + right) >> 1; if(a[middle] == q) return middle; if(a[middle] > q) right = middle - 1; if(a[middle] < q) left = middle + 1; } return -1; } void solve(){ scanf("%d", &n); for(i = 0 ; i < n ; i ++) scanf("%d", a + i); std:: sort(a, a + n); scanf("%d", &m); while(m --){ scanf("%d", &q); if(binary() != -1) ans ++; } printf("%d", ans); } int main(){ solve(); } Me too use the STL, its a simple and easy for write) And not more to time of run. 1.450 for map && 1.405 for binary_search.. Add some tests... Try this test. 5 3 6 1 2 3 4 5 4 5 6 answer : 11 Why 11 but not 12?, please explain, i don't understand that On first 3 seconds, we pick 1, 2, 3. On 4th second, we drop 1, 2, 3. On 5th and 6th second, we drop nothing. On 7th, 8th, 9th, 10th, 11th second, we pick 1, 2, 3, 4, 5. So the answer is 11. 1000 100000000000 99999971585 10 100 86 17 500 476 |
|