| Show all threads Hide all threads Show all messages Hide all messages |
| WA#3 | ~ SiriuS ~ | 1602. Elevator | 23 May 2016 14:06 | 4 |
WA#3 ~ SiriuS ~ 13 Mar 2014 15:47 UP! Can someone explain why it happened? import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Lift { public static final float LIFT_DELAY = 15; public static final float PETYA_DELAY = 5; public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(reader.readLine()); float petyaFloor = Float.parseFloat(st.nextToken()); float liftFloor = Float.parseFloat(st.nextToken()); float petyaSpeed = Float.parseFloat(st.nextToken()); float liftSpeed = Float.parseFloat(st.nextToken()); float timeByFootToTheFirstFloor = ((petyaFloor - 1) * petyaSpeed); //время, если идти до 1го этажа пешком float firstLiftDescentTime = ((liftFloor - 1) * liftSpeed) + LIFT_DELAY; //время, затраченное лифтом при спуске и простое на 1м этаже Float numOfFloorToGoByFoot = firstLiftDescentTime / petyaSpeed; //количество этажей, которые может успеть пройти Петя за время спуска лифта int numOfFloors = numOfFloorToGoByFoot.intValue(); //см. предыдущее Float numOfSeekingFloor = petyaFloor - numOfFloors; //искомый этаж float timeLiftWithPetya = (((numOfSearchingFloor - 1) * liftSpeed) * 2) + firstLiftDescentTime + PETYA_DELAY; //время на спуск, подъём к Пете на новый этаж и спуск с ним до 1го этажа if (timeByFootToTheFirstFloor < timeLiftWithPetya) { System.out.println("1"); } else if (timeByFootToTheFirstFloor == timeLiftWithPetya) { String s = numOfSearchingFloor.longValue() + ""; System.out.println(s); } else { String s = numOfSearchingFloor.longValue() + ""; System.out.println(s); } } } Re: WA#3 Oleg Baskakov 23 May 2016 13:38 50 49 0.99 0.28 Answer 21, yours 22. I've rounded up this float, now I get the same answer as you, but it still gives me WA#3 :( Could you please give me one more hint? Edited by author 23.05.2016 14:07 |
| If you have WA#8 | Izaron | 1438. Time Limit Exceeded | 22 May 2016 14:24 | 1 |
Change while (getline(cin, s)) { //... } to while (getline(cin, s)) { if (s == "") continue; //... } Test case: goto Main END: end MAIN: print 1 if 1 == 2 goto end print 2 if 1 == 2 goto end Edited by author 22.05.2016 14:25 |
| to admins | Vladimir Leskov | 1269. Obscene Words Filter | 21 May 2016 21:31 | 2 |
What is real TL? In statements it is 0.5s, but in solutions rating there are solutions which passed with time bigger than 0.5s. For some tasks, they had a bigger time limit before, but after it changed, old solutions might have not been rejudged for whatever reasons. |
| Golang 1.3: Extremely Slow fmt.Scanf | Linh Tran Tuan | 1004. Sightseeing Trip | 20 May 2016 21:26 | 1 |
!!Please be aware of fmt.Scanf poor performance!! I did everything to test it on Timus and feel so sorry for it. My code logic is ok except this! It took a day to figure out. I got AC with FreePascal before, and now Golang. So my advice is: read all input first using bufio and ioutil like this: input = bufio.NewReader(os.Stdin) output = bufio.NewWriter(os.Stdout) _wholeText, _ := ioutil.ReadAll(input) numbers := strings.Fields(string(_wholeText)) |
| How to DP without Bitmark | yeguzi | 1152. False Mirrors | 20 May 2016 13:42 | 1 |
I solved this problem by used recursion without DP. I'm trying to find a solution using DP, I found a public solution using DP + Bitmark, but it's hard to me to understand. How can I solve this problem using DP without Bitmark??? |
| little hint | 🕴 | 1226. esreveR redrO | 17 May 2016 18:44 | 3 |
All symbols are important, not "only printable". Pay attention to EOL, EOF, and symbols with codes below 32. what is EOL, EOF symbols??????? "end of line" (ascii 13 and 10) and "end of file" |
| Why WA?----------ural 1226 | + Calculous + | 1226. esreveR redrO | 17 May 2016 17:41 | 3 |
here is my code: I don't know wht's the error ,anyone help me? Const u=['a'..'z']+['A'..'Z']; Var s:string; ch:char; i:integer; Begin read(ch); while not eof do begin s:=''; while (ch in u) and (ord(ch)<>26) do begin s:=s+ch; read(ch); end; for i:=length(s) downto 1 do write(s[i]); while (not (ch in u)) and (ord(ch)<>26) do begin write(ch); read(ch); end; end; End. check whether you output EOF. If you output it you will get WA. I got really angry when I understood that my program didn't work, because I print EOF!!!! |
| why this is WA? please hepl | blackhole | 1226. esreveR redrO | 15 May 2016 23:55 | 1 |
#include<iostream> #include<algorithm> #include<string> using namespace std; int main() { string text; while(getline(cin,text)) { string s=""; for(int i=0;i<text.size();i++) if(('a'<=text[i]&&text[i]<='z') ||('A'<=text[i]&&text[i]<='Z')) s.push_back(text[i]); else { reverse(s.begin(),s.end()); cout<<s; s=""; cout<<text[i]; } cout<<endl; } //system("pause"); return 0; } |
| WA 3 (question) | Combatcook [YarSU] 🐸 | 1488. ACM Poker | 15 May 2016 15:42 | 1 |
Can anybody give some useful tests to pass test 3? And what about that situation: there are two the same cards in Dima's sleeve and there is the same card in Dima's or Sasha's set? For example: AC QH 10H JC KC 4D AC AC Is that possible? UPD: as I understood, yes... though doesn't matter, AC now. Edited by author 15.05.2016 21:18 |
| Be careful that L>=2 | teoy | 1023. Buttons | 14 May 2016 04:40 | 3 |
I got a WA because I think L can be 1 thnx man .. that should help 5 years later, same trap grabbing me :( |
| Провести своё соревнование | Informat | | 13 May 2016 12:14 | 4 |
Я хочу провести своё соревнование. Как это можно сделать? Какие есть варианты проведения? Писал по адресу timus_support@acm.timus.ru, но ответа не получил. В администрации есть кто живой? Можете дать ссылку, где написано как провести своё соревнование в codeforces? Edited by author 13.05.2016 12:23 Edited by author 13.05.2016 12:23 |
| WA on test #23 | Александър Гьорев | 1635. Mnemonics and Palindromes | 11 May 2016 03:56 | 5 |
Can anyone give me some test cases because I really don't know where my program is wrong ? Nevermind, this test case helped me find my mistake: "ababbaa" Me too. Thanks nice test. |
| Python RTE (non-zero exit code) #42 | whiord | 1915. Titan Ruins: Reconstruction of Bygones | 10 May 2016 19:55 | 1 |
Is there a way to know more precisely what is going on on the test machine? I've tested my python solution on my machine on large data (N=10^6) with a lot of copying operations (geometric progression) and got answer with memory used < 64Mb. |
| Here is my ac code and very simple to undestand on c++ | nick nikuradze | 2023. Donald is a postman | 8 May 2016 01:03 | 1 |
#include <iostream> using namespace std; int main() { int n; cin>>n; string s; int a=1; int counter=0; for(int i=0; i<n; i++) { cin>>s; if((s[0]=='A' || s[0]=='P' || s[0]=='R' || s[0]=='O' ) && a==2) { a=1; counter++;} else if((s[0]=='A' || s[0]=='P' || s[0]=='R' || s[0]=='O' ) && a==3) { a=1; counter+=2;} else if((s[0]=='B' || s[0]=='M' || s[0]=='S') && a==1){ a=2; counter++;} else if((s[0]=='B' || s[0]=='M' || s[0]=='S') && a==3){ a=2; counter++;} else if((s[0]=='D' || s[0]=='G' || s[0]=='J' || s[0]=='K' || s[0]=='T' || s[0]=='W' ) && a==1) { a=3; counter+=2;} else if((s[0]=='D' || s[0]=='G' || s[0]=='J' || s[0]=='K' || s[0]=='T' || s[0]=='W' ) && a==2) { a=3; counter++;}
} cout<<counter; system("pause"); return 0; } |
| WA#8 | Juan Pablo | 1045. Funny Game | 6 May 2016 21:27 | 1 |
WA#8 Juan Pablo 6 May 2016 21:27 my code is wrong in the test 8 but i dont know the test, can you help me? |
| Test #1? Whats wrong with my code? | Shavkat_bek | 2023. Donald is a postman | 6 May 2016 18:42 | 2 |
#include<iostream> #include<cstring> #include<cmath> using namespace std; int main(){ string st; int W,n,i=0,A[1000]; cin >> n; do{ cin >> st; if(((int)st[0]==65)||((int)st[0]==80)||((int)st[0]==79)||((int)st[0]==82)) A[i]=1; if(((int)st[0]==66)||((int)st[0]==77)||((int)st[0]==83)) A[i]=2; if(((int)st[0]==68)||((int)st[0]==71)||((int)st[0]==74)||((int)st[0]==75)||((int)st[0]==84)||((int)st[0]==87)) A[i]=3; i++; }while(i<n); for(i=0;i<n-1;i++) { int S; S=abs(A[i]-A[i+1]); W+=S; } cout<<W; return 0; } Please,help me!!! Edited by author 06.05.2016 18:42 |
| HELP ME (TIME LIMIT EXCEEDED) !! Python how to do | supanat | 1048. Superlong Sums | 5 May 2016 22:41 | 2 |
import sys n = input() arr = bytearray(n) i = 0 while i < n: line = raw_input().split() arr[i] = (int(line[0]) + int(line[1])) i += 1 result = "" i = n-1 while i > 0: if arr[i] > 9: arr[i] -= 10 arr[i-1] += 1 result = str(arr[i]) + result i -= 1
arr[0] = arr[0]%10 result = str(arr[0]) + result print result result = str(arr[i]) + result Run this code 1M iterations locally. |
| Why so? | IlushaMax | 1457. Heating Main | 5 May 2016 14:50 | 1 |
f(x) = k * (x^2 -2(a1)x + (a1)^2 + x^2 -2(a2)x + (a2)^2 + ... + x^2 -2(an)x + (an)^2) / n = k (x^2 - (2/n)(a1 + a2 + ... + an)x + ((a1)^2 + (a2)^2 + ... + (an)^2)/n so we have f'(x) = k(2x - (2/n)(a1 + a2 + ... + an)) question: what is k? (explaining from previus post) Edited by author 05.05.2016 14:53 Edited by author 05.05.2016 14:54 |
| Getting wrongs. WA 9 now WA 5. | Dhruv Somani | 1106. Two Teams | 4 May 2016 14:28 | 1 |
Earlier I had got a WA 9 but now I'm getting a WA 5 with the same code. What's the logic? |
| O(N^2) idea, works fine | Marian Darius | 1297. Palindrome | 3 May 2016 22:00 | 3 |
4686044 16:50:13 21 Dec 2012 Marian Darius 1297. Palindrome C++ Accepted 0.031 108 KB Just try iterating the middle of the palindrome and extend to both ends, until you find two elements that are different. Seriously? Are you really think that you are the first who do it for O(N^2) with the same idea? And it's not the first topic in the forum about this algo. I don't know why but I get a TLE in #15 with the same approach as yours. |