12197 - Trick or Treat
Moderator: Board moderators
-
- New poster
- Posts: 1
- Joined: Mon Nov 03, 2014 12:21 pm
Re: 12197 - Trick or Treat
Hi, I've tried to solve this problem both in Java and C++ by using ternary search. Even though I'm using the same strategy, Java's verdict is Time Limit Exceeded and C++'s verdict is Accepted. Looking at the problem statistics, it looks like the judge is giving Time Limit Exceeded to almost every Java submission. There is only one Accepted submission in Java.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12197 - Trick or Treat
Yes C++ is faster than Java. BufferedReader and BufferedWriter are faster than non-buffered I/O.
Check input and AC output for thousands of problems on uDebug!