| Show all threads Hide all threads Show all messages Hide all messages |
| Why this program get Compilation error? | eeeeeeee | 1226. esreveR redrO | 28 Feb 2007 21:59 | 2 |
var st:array [1..100] of string; qwe:string; i,w,n,j,k,l:longint; Procedure prover(q:longint); var e:longint; begin w:=0; for e:=q to length(st[i]) do begin if (st[i][e] in ['a'..'z']) or (st[i][e] in ['A'..'Z']) then begin inc(w); qwe:=qwe+st[i][e]; end else exit; end; end; begin while not eof do begin inc(n); readln(st[n]); end; for i:=1 to n do begin for j:=1 to length(st[i]) do begin if st[i][j]=' ' then write(' ') else begin if (st[i][j] in ['a'..'z']) or (st[i][j] in ['A'..'Z']) then begin qwe:=''; prover(j); for l:=w downto 1 do write(qwe[l]); j:=j+w-1; end else write(st[i][j]); end; end; writeln; end; end. var st:array [1..100] of string; qwe:string; i,w,n,j,k,l:longint; Procedure prover(q:longint); var e:longint; begin w:=0; for e:=q to length(st[i]) do begin if (st[i][e] in ['a'..'z']) or (st[i][e] in ['A'..'Z']) then begin inc(w); qwe:=qwe+st[i][e]; end else exit; end; end; begin while not eof do begin inc(n); readln(st[n]); end; for i:=1 to n do begin for j:=1 to length(st[i]) do begin if st[i][j]=' ' then write(' ') else begin if (st[i][j] in ['a'..'z']) or (st[i][j] in ['A'..'Z']) then begin qwe:=''; prover(j); for l:=w downto 1 do write(qwe[l]); j:=j+w-1; // You can't change j in loop!!! end else write(st[i][j]); end; end; writeln; end; end. j:=j+w-1; // You can't change j in loop!!! Edited by author 28.02.2007 22:03 |
| I have WA on test 17 ! Can anyone give me it ? | Vladimir Li | 1400. Cellular Characters | 28 Feb 2007 17:37 | 3 |
I can give you! Edited by author 28.02.2007 17:36 kotagimdi zheme! 17 test... |
| WA ON 22 | @FEAR | 1325. Dirt | 28 Feb 2007 17:10 | 11 |
I've submited 2 ACed Programs but they both got WA ON22. So does my programs. why~? Is there any trick ~~? Mine (Dijkstra with heap) gets WA on 22 too. I don't know what's wrong. Maybe someone else can help us. Help me, still WA on test22 Thanks I got AC, I had a bug, but can't remember what. Re: WA ON 22 Dart MirzMan C++ Edition (Mirzoyan Alexey, Rybinsk SAAT) 28 Feb 2007 17:10 Ronnie wrote: Mine (Dijkstra with heap) gets WA on 22 too Dijkstra??? Is it O(n^4)? 500^4 - too long... Be careful to this test: 4 4 2 1 1 3 0220 1001 1001 0110 Re: WA ON 22 Einstein Chen(einstein[underline]csm[at]hotmail[dot]com) 29 May 2005 11:08 Re: WA ON 22 Einstein Chen(einstein[underline]csm[at]hotmail[dot]com) 1 Jul 2005 20:53 what a bug! finally accepted... The answer is 3 1 Isn't it? |
| ????????? | Shady TKTL | 1009. K-based Numbers | 28 Feb 2007 14:36 | 1 |
Can anyone explain me this problem by easy words. My friend told me that we can solwe this problem with Fibonacci formula. But I didn't understand how can I do it. So I need in your help. P.S. Sorry for my English
|
| Anybody can help? i got wa#10 | Dan.hu | 1425. Queen 2 | 28 Feb 2007 13:43 | 5 |
Try this tests 5 100 1 1 1 1 1 ------- 196120 5 100 50 50 50 50 50 ------- 858180 4 100 1 1 1 1 1 -------- 112912 How many new positions maximal number may be? It seems that it is not very much. Therefore we may don't use clear combinatorical approach but just build each new position acording roules of king moving , put it in set and set itself esclude multuples. This is not mathematic but just context's way. If new positions number too much and we have TLE we may count mathematically simple subset as two roork's moving and for rest use set's approach. But going this way I have TLE14 Edited by author 28.02.2007 10:01 Max answer is 858180 I think 5 100 50 50 50 50 50 Probably it's 16 test Potentially queen can reach ~3000000 cells, but many of them coincide. I just choose different from this I hash 5 byte to 4 |
| I've solved it with hash, but it's not good way | KIRILL(ArcSTU) | 1425. Queen 2 | 28 Feb 2007 03:24 | 1 |
Does anybody solve it without hash? I can get just 1 right hash from several hundreds |
| WA test 16 after rejudge. Why? Can anybody help me? | Kaliningrad SU -Dmitry-HeadLiner | 1269. Obscene Words Filter | 28 Feb 2007 02:35 | 1 |
|
| Serch by country | Sergio Marquez | | 28 Feb 2007 01:00 | 1 |
I would like can to search Authors by country, How can I do? |
| How to read data correctly, using C#??? | Stepanko%POLYTEH% | 1000. A+B Problem | 27 Feb 2007 23:38 | 3 |
This is my solution: ------------------------------------------------------- .....int a, b; .....string s; .....s = Console.ReadLine(); .....a = Int32.Parse(s.Substring(0, s.IndexOf(" "))); .....b = Int32.Parse(s.Substring(s.IndexOf(" "))); .....Console.WriteLine("{0}", a + b); ------------------------------------------------------- Are there some easier way to read two integers without Console.ReadLine(); or somthing else, if they are stored in the same line with space: 100 200 I think that a = Int32.Parse(s.Substring(0, s.IndexOf(" "))); is not good solution in this case. String[] numbers = Console.ReadLine().Split(' '); try { Console.WriteLine(Int32.Parse(numbers[0]) + Int32.Parse(numbers[1])); } catch {} |
| Why if i output path that isn't simple i get WA#12? | AS1_PML#30 | 1527. Bad Roads | 27 Feb 2007 21:14 | 1 |
I can't find in statements anything about it, so write without checking. Afrer deleting cycles y have AC. Why? Edited by author 06.03.2007 17:32 |
| Легенда | Ilya Rasenstein (Lyceum #40) | 1473. Farm 2 | 27 Feb 2007 16:48 | 4 |
Легенда Ilya Rasenstein (Lyceum #40) 12 Dec 2006 11:18 Нет, задача конечно хорошая, но легенда - это вообще что-то с чем-то. :)) But too simple? 1) Sort rays (ai,bi) by angle; 2) if on ray >1 point-Impossible; 3) find integer bissectors or near bissectors between rays (qi,hi); 4) -hi,qi- answers |
| Help me please! Program crashes on test 3! | D_O_double_G | 1446. Sorting Hat | 27 Feb 2007 15:03 | 2 |
|
| Hm.. strange WA#6 | ruX | 1201. Which Day Is It? | 27 Feb 2007 11:35 | 1 |
Please, give me test #6 I have passed a lot of test from this forum... |
| If you have WA#7 | Burmistrov Ivan (USU) | 1244. Gentlemen | 27 Feb 2007 08:10 | 6 |
If you have WA#7, try this test: 15 7 1 1 2 3 8 16 17
This test works , but I still have WA#7. |
| I asumed that Z = 2 and then solved problem. but I can't proove it. can you? | @ntiFreeze | 1428. Jedi Riddle | 27 Feb 2007 02:41 | 3 |
Edited by author 27.02.2007 00:36 Simple)) z = 2; So x^a+y^b=2^c => 2^(c-1) + 2^(c-1) == 2^(c-1)*(1+1) == 2^(c-1)* 2^1 = 2^(c-1+1) == 2^c; => x^a == 2^(c-1), y^b = 2^(c-1) => x == 2^((c-1)/a), y== 2^((c-1)/b). |
| Probably 10th test has a bug! | [SPbSU ITMO] Yuri Bedny | 1196. History Exam | 26 Feb 2007 21:14 | 3 |
I used the following O(m) algorithm, where 'a' - teacher's list, 'b' - student's list. I got WA on test 10. After sorting _teacher's_(!) list as well, program was accepted. Therefore, it seems that 10th test has a bug. Am I right, or maybe missed smth? It seems this bug wasn't mentioned before, 'cause general approach is not O(m), but O(m*ln(n)) solution, which uses O(n) memory. And that approach may work somehow.. Arrays.sort(b); int c = 0; int j = 0; for (int i = 0; i < a.length; i++) { if (i > 0 && a[i] == a[i - 1]) continue; while (j < b.length && b[j] < a[i]) { j++; } while (j < b.length && b[j] == a[i]) { c++; j++; } } cout.println(c); Argument follows.. This program craches on test 10. cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); PrintWriter cout = new PrintWriter(System.out); int a [] = new int[readInt()]; for (int i = 0; i < a.length; i++) { a[i] = readInt(); } for (int i = 1; i < a.length; i++) { if (a[i] < a[i - 1]) throw new RuntimeException("10th test is wrong."); } You are right! Test is fixed now. 9 authors got AC. Thank you for help. |
| Invalid test 12 | Fyodor Menshikov | 1291. Gear-wheels | 26 Feb 2007 20:54 | 2 |
Connection scheme in test 12 is asymmetric. There are wheels i and j, that j-th wheel is listed in the list of i-th, but i-th is NOT listed in the list of j-th. |
| Give me deciding of this Question, please... | exodus3412 | 1402. Cocktails | 26 Feb 2007 15:03 | 1 |
Please send decide of this task to the my e-mail azkaban2004@mail.ru . Please give the extension of the task in *.pas!!! Edited by author 26.02.2007 15:07 |
| could someone be so kind and explain to me the O(n log n) algorithm ? | Diana Adrisor | 1028. Stars | 25 Feb 2007 23:55 | 3 |
if it is more convenient for you send it to dianaadrisor@yahoo.com. thank you very much :) i solved the problem thanx to andrei teo who was such a sweety :) Can someone explain to me the binary indexed tree that you use here, my mail is tabledott@gmail.com |
| I think it's the fastest, but TLE - ??? | KAV | 1435. Financial Error | 25 Feb 2007 23:09 | 12 |
I use such an algorithm: SumNeed - the last number in the input, what it's need to have sum - the physical sum of all numbers If ( SumNeed - sum ) does not divide by 9 - unrecoverable error. Else ( SumNeed - sum ) / 9 is the difference between swapped digits. So I look through all the numbers, and if there are digits with difference ( SumNeed-sum )/9 - it is the mixed number. On my computer when N=1500000 it works nearly 0.1 sec, and how it gets TLE - I can't even imagine. :( [code cut] Edited by moderator 16.03.2009 01:25 Use scanf()! I had same problem. But now I have WA #45 :( Any hints? :) The fastest one: Don't read numbers as integers! Read it as string or char[] This way brings AC 0.18 sec PS: In such problems (input data is large and TL is small) don't use scanf or cin to read integer numbers. So, you think that the algorithm is good, but reading input takes all the time? Well, I will try to change, to read strings. Thanks! Thanks to all, I have converted the algorithm into strings, now it is about 0.25 sec. But - WA 45 :( I can't guess why. Is unsigned __int64 enough? Burmistrov Ivan (USU), you told that you also had WA 45. Have you overcome this problem? It's very strange!!! Statement: "Each of the next N lines contains a corresponding non-negative integer summand (not exceeding 2^31-1)." 2^31 is 2147483648 - 10 symbols. All input numbers I kept in char[11] and got WA. When I changed the type into char[12] - I got Accepted!!! How to explain it? ;) !!! No question. My stupid fault :( YES, AC 0.171 8-) Edited by author 09.03.2006 17:22 Now I have WA #46 :( In 45-th test correct number more than 2^31-1, I think. But what is 46-th test? I have WA #46 :( What's the problem??! AC Dr.Korbin 10 Mar 2006 03:21 O, I think I undestood, what was wrong. I had an array "long int a[1500000]", and other variables were __int64. When I corrected "__int64 a[1500000]", my program began to eat 12MB of memory instead of 6MB, but I got AC!!!! Edited by author 10.03.2006 03:22 Re: AC Dan.hu 25 Feb 2007 23:09 u are quite right! i got AC this way,too! Thx u for ur hints! but does it mean the judge writer use number greater than 2^31-1? if yes, i have a feeling of being fooled! |