dnwdwndiwn's blog

By dnwdwndiwn, history, 3 years ago, In English

QUESTION

question summary

my atcoder submission

MY CODE

MY CODE PASSES HALF TEST CASES AND FAILS HALF BECAUSE OF RUNTIME ERROR . WHAT MISTAKE HAVE I DONE ?

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

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

The space complexity for your solution is O(n^2). So, for test cases with n > 1000 your solution is exceeding the memory limit. In general you can create an integer array of size ~ 1e6. Try coming up with a solution having Space Complexity O(n) or O(nlogn).