| Show all threads Hide all threads Show all messages Hide all messages |
| WA1 Really! | VNXtreMe | 1446. Sorting Hat | 9 Dec 2013 23:52 | 3 |
This is one of the easiest problem in timus and I can't believe i'm getting WA1 for this problem. Im solving this problem using C++ and I'm using getline method from sstream to get the input. I'm storing the names in vectors and printing them with empty lines between the houses. I know Test 1 is usually the given data, but im getting WA1 even though I'm getting the same answer in my computer as given in the problem description. Does anyone know how to overcome this WA1 problem? Edited by author 03.01.2012 15:53 Ok so I found the problem, I know timus is piping the input and output via text files and the problem in that was that repeated getlines will fail. So I used the piping method as mentioned in timus and the problem was visible as it printed empty output to the output file. If you want to know how to pipe inputs and outputs follow the below link(look under Other notes section)- http://acm.timus.ru/help.aspx?topic=cppFor example : cin>>number; while(true){ getline(cin,input1); getline(cin,input2); if(somecondition) break; } However while(getline(cin,input)) {do} will work. But since we need 2 inputs the above code will fail as getline will return empty strings due to the reasons mentioned here- http://www.cplusplus.com/forum/articles/6046/ I overcame the problem using cin.ignore() just before entering the loop as to flush the input stream correctly and the corrected code of above may look like the code below- cin>>number; cin.ignore();//flushes input stream while(true){ getline(cin,input1); getline(cin,input2); if(somecondition) break; } If this didn't work then I suggest you to program in other languages. Edited by author 04.01.2012 10:41Thanks... great help indeed ... :) |
| How do i wrote integers | Chitanda Eru | 1976. Game Optimization | 9 Dec 2013 18:46 | 1 |
My solution jumped from TL 19 to AC in under 0.3s when i replaced output via printf with writing each digit of a number via putchar. That just blew my mind. |
| why got WA#43, some hints? PLZ ! | Heng | 1463. Happiness to People! | 9 Dec 2013 11:43 | 1 |
Edited by author 09.12.2013 11:44 |
| WA9 | Mamuka Sakhelashvili [Freeuni] | 1354. Palindrome. Again Palindrome | 9 Dec 2013 01:44 | 1 |
WA9 Mamuka Sakhelashvili [Freeuni] 9 Dec 2013 01:44 Could you tell me what is test N9? |
| AC 0.062 | TakeOver [MSU] | 1204. Idempotents | 8 Dec 2013 03:19 | 1 |
AC 0.062 TakeOver [MSU] 8 Dec 2013 03:19 O(k*(sqrt(n)/log(n) + log(n))). hint: precalc primes table(so, we can factorize number using O(sqrt(N)/log(N)) operations). gl. |
| I got WA on 23-th test!!! | Roibu Yulian | 1299. Psylonians | 7 Dec 2013 20:36 | 1 |
Can somebody help me? I don't know what to do. I tried a lot of tests and all answers were correct. My code: #include<stdio.h> #include<conio.h> #include<math.h> #include<stdlib.h> #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) int main() { long a, b, x, y, z, p, q; char ch; scanf("%d%d", &a, &b); scanf("%s", &ch); scanf("%d%d%d", &x, &y, &z); a=min(a, 100); if(ch=='A') scanf("%d%d", &p, &q); if(ch=='P') scanf("%d", &p); if(ch=='P') if(x>0) ch='D'; else { if((abs(p)>20)&&(abs(p)<160)){ if(((p>20)&&(p<=(90)))||((p<=-90)&&(p>-160))) printf("LEFT %d", a); else printf("RIGHT %d", a); } else if(abs(p)<=20) printf("FRONT %d", a); else printf("BACKWARD %d", a); } if(ch=='D') if((x>0)&&((x*20)>=b)) if(abs(z)<5) printf("FIRE %d", min(20, b)); else printf("BACKWARD %d", a); else ch='G'; if(ch=='G') { if(x==0) printf("STOP"); else { if(abs(z)<5) printf("FIRE %d", min(20, b)); if(z>=5) printf("LEFT %d", a); if(z<=-5) printf("RIGHT %d", a); } } if(ch=='A') if((p*q)>(3*(x*y))) if((x>0)&&(abs(z)<10)) printf("FIRE %d", min(20, b)); else printf("FRONT %d", a); else if((x>0)&&(abs(z)<5)) printf("FIRE %d", min(20, b)); else printf("BACKWARD %d", a); } |
| WA6 | Oybek | 1607. Taxi | 7 Dec 2013 15:33 | 6 |
WA6 Oybek 8 Oct 2008 18:13 My code: why WA#6 import java.io.*; import java.util.*; public class misol1607 { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out);
int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); int d = in.nextInt(); int r=c; while (a<c) { if ((a+b)>=c) { r=c; break; } else { a=a+b; }
if (a>=(c-d)) { r=a; break; } else { c=c-d; } }
out.println(r);
out.flush(); } } 11 1 10 2 Edited by author 20.03.2010 17:26 Re: WA6 IgorKoval [PskovSU] 20 Mar 2010 18:04 if(a==11 && b==1 && c==10 && d==2) cout<<11; Получается так: Садится в машину Петька и говорит:"11 руб" Таксист говорит: "Нет, брат, это слишком много для меня. Я подвезу тебя за 10 руб." Петька: "Послушай, товарищ, я настаиваю. Поехали за 11 руб." Таксист: "OK!" ИЛИ ЖЕ Получается так: Садится в машину Петька и говорит:"11 руб." Таксис радостно: "Поехали!!!!" И думает про себя:"Во дает! А я его бы и за 10 руб. подвез бы". Edited by author 20.03.2010 18:05 Edited by author 20.03.2010 18:05 |
| Wrong answer, why???????? | Grigorij | 1001. Reverse Root | 7 Dec 2013 13:29 | 2 |
double h[131072],a,s; int main() { int i=0,j; freopen("input.txt", "rt", stdin); while(cin>>a){ h[i]=a; s=sqrt(a); h[i]=s; i++; } for(int j=(i-1);j>=0;j--){ cout<<setiosflags(ios::fixed)<<setprecision(4)<<h[j]<<endl; } return 0; } |
| test #1 | AntiBug | 1650. Billionaires | 7 Dec 2013 02:39 | 2 |
Can anyone explain me test #1; London keeps 1st from day 12 to 21 (10 days) and 23 to 25 (3 days). Day 22th London = StPetersburg (=15b). Why output is London 14? Re: test #1 👨🏻💻 Spatarel Dan Constantin 7 Dec 2013 02:39 The leaders are: 1- 1 London 2- 5 [tie] 6-10 Anadyr 11-11 Moscow 12-15 London 16-20 London 21-21 London 22-22 [tie] 23-25 London It seems you missed day 1. |
| Sonmeone post the solution please :d | Furcoiu Ionut | 2001. Mathematicians and Berries | 7 Dec 2013 01:14 | 3 |
|
| It AC! Funny solution | n0eR | 1295. Crazy Notions | 6 Dec 2013 23:28 | 3 |
uses SysUtils; var a : array[0..10000] of longint; n, m, i, x, y : longint; begin readln(n); if n = 1 then writeln(1) else if n mod 4 = 0 then writeln(0) else if (n mod 4 = 3) or (n = 25) or (n = 5) then writeln(2) else writeln(1); readln; end. i don't think it correct. how about 45 65 ? 85 ? 105 ? your code isn't always correct . you must use : if (n mod 4 = 1 and n mod 5 = 0) writeln(2) this is correct...
|
| Some test for this problem | Adhambek | 1135. Recruits | 6 Dec 2013 23:00 | 1 |
15 <>><<> <<><<< >>< answer is : 28. my program is accepted. |
| Idea? | NotImplemented | 1997. Those are not the droids you're looking for | 6 Dec 2013 22:58 | 1 |
Idea? NotImplemented 6 Dec 2013 22:58 I have solved it using max bipartite matching. Is there any better idea? |
| WA #7 | chickenway | 1210. Kind Spirits | 6 Dec 2013 08:41 | 1 |
WA #7 chickenway 6 Dec 2013 08:41 I'm wrong with test 7, can someone give me some test? Thanks. Edited by author 06.12.2013 09:29 Edited by author 06.12.2013 09:29 |
| What`s test 1??? | grandvic | 1343. Fairy Tale | 6 Dec 2013 08:14 | 2 |
|
| Лимиты | ltoonru | | 5 Dec 2013 23:29 | 1 |
Лимиты ltoonru 5 Dec 2013 23:29 Огорчает одинаковый лимит времени для компиляторов и интерпретаторов. На Джаве приходится уже не оптимизировать, а извращаться. Может, есть смысл ввести разумный коэффициент ? |
| помогите help Visual C++ 2010 Runtime error (access violation) 2 0.64 260 КБ | DeDaRm | 1086. Cryptography | 5 Dec 2013 19:34 | 3 |
#include <iostream> using namespace std; int main () {
int n[1755],z=2,a=0,y,t=0; for (z=2;z<=15000;z++) { for (int i=1; i<=z; ++i) { y=z/i; if (y*i==z) { a=a+1; } } if (a==2) { n[t]=z; t++; } a=0; } int x; cin >> x; int *b=new int[x]; for (int e=0; e<x; ++e) { cin >> b[e]; } cout << "\n" << "\n"; for (int e=0; e<x; ++e) { cout << n[b[e]-1] << " "; } system ("pause > void"); } Delete: system ("pause > void"); now Visual C++ 2010 Runtime error (access violation) 2 0.64 260 КБ |
| WA 3 ---->C++ pls help | DeDaRm | 1209. 1, 10, 100, 1000... | 5 Dec 2013 19:32 | 1 |
#include <iostream> #include <cmath> using namespace std; int main () { int x,e; double nk; cin >> x; int *b=new int[x]; for (e=0; e<x; ++e) { cin >> b[e]; } for (e=0 ; e<x; ++e ) { nk = (pow((8*b[e]-7),0.5)-1)/2; long int k = static_cast< int >( nk ); if ( nk==k ) { cout << "1 "; } else { cout << "0 "; } } system ("pause > void"); } Edited by author 05.12.2013 19:32 |
| WA7 | async_prince | 1807. Cartridges for Maxim | 5 Dec 2013 16:40 | 2 |
WA7 async_prince 21 Oct 2011 15:40 Please write answer for N = 169, 841, 674041. ALSO WA7, who give more test? |
| #wa2, please give me test | ixe | 1110. Power | 5 Dec 2013 12:31 | 1 |
|