Блог пользователя rajpm

Автор rajpm, история, 5 лет назад, По-английски

I am getting TLE for a simple java program for reason I can't find. I read past blogs and found that using Scanner and sorting primitive type arrays is the general reason, but my program isn't in any of those category.

My submission: https://codeforces.com/contest/1206/submission/61017893

EDIT: Using the PrintWriter instead of System.out.printf() worked.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

don't use printf, it's slow

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Use the good old PrintWriter. Or just System.out.write (raw bytes), which is even faster.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

awesome. Using the PrintWriter worked. Thanks guys. So silly of me. I had the PrintWriter in the template I copied to resolve the TLE, just didn't use it.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by rajpm (previous revision, new revision, compare).