My solution is correct for the test data and it should be efficient. O(1) with some simple calculations. Still I get TLE??
My solution is in Java and I read until EOF so it shouldn't wait for more input I think.
Is the number of test cases extremely large or what am I missing?
10491 - Cows and Cars
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10491 - Cows and Cars
Try using BufferedReader and BufferedWriter, or post your code. Someone recently solved it using Java.
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 3
- Joined: Thu Apr 10, 2014 10:54 am
Re: 10491 - Cows and Cars
Thanks Brian. I used BufferedReader already and buffered output in a StringBuilder before printing everything in a chunk.
Tried again now with a minor change and got AC. Maybe some misfortuned garbage collection or something I haven't understood that TLE'd last time. Anyhow, thnx.
Tried again now with a minor change and got AC. Maybe some misfortuned garbage collection or something I haven't understood that TLE'd last time. Anyhow, thnx.