| Show all threads Hide all threads Show all messages Hide all messages |
| Stack overflow | abdujabbor | 1001. Reverse Root | 25 Nov 2012 21:24 | 3 |
I dont know if I use the array with size 131072 I get result "access violation" if I use the size 131073 I get the result "stack overflow" so how I get the right way to resolve the problem, sorry for my bad english; #include <stdio.h> #include <math.h> int main() { int index = -1; double stack[131073]; while(scanf("%lf", &stack[++index]) != EOF); for(; top > 0;printf("%.4lf\n", sqrt(stack[--index]))); return 0; } #include <stdio.h> #include <math.h> double stack[131073]; int main() { int index = -1; while(scanf("%lf", &stack[++index]) != EOF); for(; index > 0;printf("%.4lf\n", sqrt(stack[--index]))); return 0; } Did you resolve the problem? |
| WA #1, though answers are equal to the sample. | CLearER | 1079. Maximum | 25 Nov 2012 12:59 | 2 |
Edited by author 07.12.2012 09:36 Problem is here : floor(x+0.5); You are not saving result of this function :) |
| Ural SU contest. Petrozavodsk training camp. Winter 2008 | Anton Lunyov | | 25 Nov 2012 02:17 | 1 |
Why this contest is absent in archive of competitions: http://acm.timus.ru/monitor.aspx?id=61? And why I was disqualified from it? I am very advanced mathematician so why the fact that I solved problems A and B during the contest so bothered admins? It's complete lawlessness :( |
| I use 'array[500,500]',then use dispose,Why momery limited? | Lin | 1250. Sea Burial | 25 Nov 2012 01:45 | 2 |
Maybe you use recursion fill field? |
| Test for WA#8 | Abdulmalik Abdulpotiev [MSU_Tashkent] | 1014. Product of Digits | 24 Nov 2012 23:50 | 3 |
Test for WA#8 Abdulmalik Abdulpotiev [MSU_Tashkent] 3 Dec 2011 01:54 But 26 is less than 34 Edited by author 24.11.2012 23:51 |
| Help me 'Crash (stack overflow)' | hhiepit | 1586. Threeprime Numbers | 24 Nov 2012 17:29 | 1 |
My solutions is stack overflow in test 9. Help me, please. |
| Hlep-WA Test6 | moonshang | 1002. Phone Numbers | 23 Nov 2012 22:05 | 1 |
Could anyone give me the test#6? godsuriyel@gmail.com thanks! |
| what's test2 ? | The Dragon Warrior | 1917. Titan Ruins: Deadly Accuracy | 23 Nov 2012 21:36 | 8 |
It helped me: 5 4 2 2 1 1 1 answer: 5 2 EDITED - NEVER mind - I think I understand Edited by author 07.11.2012 09:58 Edited by author 07.11.2012 09:58 Becase 1 spell of strength 2 eliminates 3 coins (1, 1, 2) The (4,4) can never be eliminated because it causes a bounce back of 8, and 7 is the survival limit |
| Need help wa#2 | Pegasus | 1917. Titan Ruins: Deadly Accuracy | 23 Nov 2012 21:02 | 1 |
I want some tips or tests |
| No subject | sanzhar | 1114. Boxes | 23 Nov 2012 19:41 | 1 |
var i,s3,s4,s,s1,s2,n,a,b:Longint; begin read(n,a,b); s:=1; s1:=1; s2:=1; s3:=1; s4:=1; for i:=1 to n+a do s:=s*i; for i:=1 to n+b do s1:=s1*i; for i:=1 to n do s2:=s2*i; for i:=1 to a do s3:=s3*i; for i:=1 to b do s4:=s4*i; write((s*s1)/(s2*s3*s4*s2)); end. |
| what is the test #5? How was I wrong at it? | challenge | 1869. New Year Cruise | 23 Nov 2012 18:14 | 3 |
My solution is that 1. I calulate how many passengers go off when the train arrive the station i , called Di[i] (assume we are doing on the first turn that is from Vladivostok to Moscow). And I also have similar manipulation on doing the second turn that is from Moscow to Vladivostok), called Ve[i] 2. Then, I do for (i = 2; i <= n; i++) to browse all stations that the train will come. At station i, I subtract the number of passengers who go off the train at the station (i - 1) and plus the number of passengers who will come to the station i. And, I find the MAX from them at every station i, called luotDi. I do the same with the second turn from Moscow to Vladi..., called luotVe 4. I find maxPassengers = max(luotDi, luotVe) 5. I print the result (how many cars) = maxPassengers / 36 + 1 * (maxPassengers % 36 == 0 ? 0 : 1) I can't find what I was wrong. Please help me! Here my source code #include <iostream> using namespace std; int main() { int n; int tam; int a[106][106]; int Di[106]; int Ve[106];
int luotDi = 0; int luotVe = 0; cin >> n; for (int i = 0; i <= n + 5; i++) { Di[i] = Ve[i] = 0; }
for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> a[i][j]; if (i < j) { Di[j] += a[i][j]; } else { if (i > j) Ve[j] += a[i][j]; } } }
// the first turn (Vla... -> Moscow) int soKhach = 0; // station j th for (int j = 2; j <= n; j++) { // drop passengers soKhach -= Di[j - 1];
// pick up passengers for (int i = 1; i < j; i++) { soKhach += a[i][j]; }
// find MAX if (soKhach > luotDi) { luotDi = soKhach; } }
// the second turn (Moscow -> Vla...) soKhach = 0; // station j th for (int j = n - 1; j >= 1; j--) { // drop passenger soKhach -= Ve[j + 1]; // pick up passenger for (int i = n; i > j; i--) { soKhach += a[i][j]; } // find MAX if (soKhach > luotVe) { luotVe = soKhach; } }
int result; float lDi = (float) luotDi; float lVe = (float) luotVe; if (luotDi > luotVe) { lDi = lDi / 36; result = (int) lDi; if (result < lDi) { result++; } } else { lVe = lVe / 36; result = (int) lVe; if (result < lVe) { result++; } }
cout << result; return 0; } Thanks very much! Edited by author 15.10.2011 17:52 The way you calculate drop and pick up passengers is wrong :(. Edited by author 16.10.2011 12:29 Edited by author 23.11.2012 18:15 |
| I do not understand an sample. help, please | alp | 1162. Currency Exchange | 23 Nov 2012 16:21 | 4 |
how Andrey will increase the capital? 2: (20-1)*1 =19 3: (19-1)*1=18 **** How can more, than 20? thank I understood,...:) Edited by author 18.02.2017 01:54 I'm too... Please, somebody explane sample. Why I can only increase money: 1->2 (20-1)*1=19 2->3 (19-1)*1.1=19.8 3->2 (19.8-1)*1.1=20.68 2->1 (20.68-1)*1=19.68 Where I mistake. Or Nick can just do all day 2->3 3->2 2->3 3->2 ........ ........ 2->3 3->2 and when he will have INF money, he exchange currency from 2 on 1. =) Edited by author 10.10.2012 03:56 just ignore the words "Let us call some sequence of the exchange operations simple if no exchange point is used more than once in this sequence." it's sample spfa |
| regarding input taking | shariq | 1001. Reverse Root | 23 Nov 2012 15:23 | 2 |
unable to understand do we have to read input from file or user i mean how many numbers are taken as input. as in sample four numbers are given plz help Edited by author 23.11.2012 09:56 Edited by author 23.11.2012 09:56 This problem is a little different from the others in terms of input. You're not told ahead of time how many numbers there are, but you are told the input will not exceed a certain number of bytes (the byte limit info which you don't have to use if you don't want to). You read from standard input, like all other problems, until there is no more input. E.g., "while not end of file, read the next number..." |
| Test 3 | Alexander Goncharov | 1269. Obscene Words Filter | 23 Nov 2012 13:28 | 1 |
Test 3 Alexander Goncharov 23 Nov 2012 13:28 I use Aho Corasick algorithm but get "Wrong answer 3". Why? Please give me test 3. Edited by author 23.11.2012 13:28 |
| DO LIKE ME Accepted HE MY PROGRAM memory 17 byte | Oleg | 1135. Recruits | 23 Nov 2012 11:06 | 5 |
var i,n,L,R:longint; ch:char; begin readln(n); L:=0; R:=0; for i:=1 to n do begin read(ch); while not(ch in ['<','>']) do read(ch); case ch of '>':inc(R); '<':inc(L,R); end; end; writeln(L); end. Denote by R the number of recruits at the right end of the queue. When you get a new '>', simply increase R by 1. If you receive a '<', the process is like this: >>>>>< (Say R=5) >>>><> >>><>> >><>>> ><>>>> <>>>>> Now you see, it takes exactly R turns to send the '<' to the left of the '>'s, and the number of the '>'s, or R, stays the same. So it's easy to understand the prog. 10 >>>><>>>< What about this test? |
| TLE(c++)? | mah1991 | 1135. Recruits | 23 Nov 2012 09:29 | 3 |
why do i get Time limit exceeded :( #include <cstring> #include <cstdlib> #include <cstdio> using namespace std; int main () { char * pch; char str[30005],str1[30005]; int number,i=0,j=0; scanf("%d",&number); while(i<number) { scanf("%s",str); i+=strlen(str); strcat(str1,str); } while(strstr(str1,"><")) { pch=strstr(str1,"><"); strncpy(pch,"<>",2); j++; } printf("%d",j); return 0; } I used very similar code and got AC (though there is a better solution if I recall correctly). What I did is: - If you have <<< at left end or >>> at right and, you can ignore those - they will never change again. Thus, you can keep treack of the left and right endings, and only parse those, instead of going from 0 to n every time. AC 0.625 #include <iostream> using namespace std; int main() { int n; cin >> n; char c; int t = 0, ans = 0; while (n--) { cin >> c; if (c == '>') ++t; else ans += t; } cout << ans << endl; return 0; } |
| Russian version of statement | Yermak | 1655. Somali Pirates | 23 Nov 2012 08:57 | 1 |
Эпиграф: следует писать "филиппинцы". Последнее предложение первого абзаца: "иначе пушку уже нельзя будет навести на цель, и команда попадет в плен" - запятая не нужна. |
| please provide me some tests | async_prince | 1002. Phone Numbers | 22 Nov 2012 23:11 | 6 |
WA4, i still don't know why :) please give me some cool inputs and (optionally) your answers to them. 1234567890 10 jafgl n ehlnr tyz ru ja iad jadh pty yo ans:ja ehlnr tyz thank you, i've already found mistakes. now optimizing memory strategy... the test that tiancaihb give has two possibile solutions: ja ehlnr tyz jafgl n ru yo the first one is shorter so it work fine in my program but I stil get WA4 and do not know where to look for mistake. Can someone give me any tip in what cases it work wrong. Another test. Mainly to check TLE: 2222223222222222322222 etc. 5 a aa afa aaaa aafaa Answer - aaaa aafaa aaaa aa afa aaaa Answer - aaaa aafaa aaaa aa afa aaaa Answer - aaaa aafaa aa aaaa afa aaaa |
| for admin | BoburSh | 1014. Product of Digits | 22 Nov 2012 22:51 | 2 |
To whom it may concern! There were sovlved two different programms. The first one, when there is given an input 120 the output is 358; the second output is 456. But both of them were accepted. Could you explain to me why this that, if you please? It's because of weak tests :D |
| What should I do if N is odd? What's the first 'half' and the second 'half' in this case? | Maigo Akisame (maigoakisame@yahoo.com.cn) | 1289. One Way Ticket | 22 Nov 2012 13:00 | 5 |
|