Siriuslight's blog

By Siriuslight, history, 6 years ago, In English

I have started learning JAVA recently. I wrote a code for this problem.

Reference to my code is here.

I can't find out why it is giving me TLE. Can someone help out?

UPD : I found the problem. I needed to keep 1 << 20 in parenthesis.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Don't use Scanner/System.out.println, use BufferedReader and PrintWriter instead.

BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
PrintWriter w = new PrintWriter(System.out);
»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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