12197 - Trick or Treat

All about problems in Volume 121. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
New poster
Posts: 1
Joined: Mon Nov 03, 2014 12:21 pm

Re: 12197 - Trick or Treat

Post by pedropobla »

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.

Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12197 - Trick or Treat

Post by brianfry713 »

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!

Post Reply

Return to “Volume 121 (12100-12199)”