JVirak's blog

By JVirak, history, 8 years ago, In English

Hi All I'm getting a timeout error for this question. As far as I can tell my algorithm is the same as the one in the tutorial and it's implemented in C++ so I'm at a loss for why it's not fast enough. Moreover when I change from reading in the input to automatically generating an input the same size it takes 13ms and the question allows 1000ms/1s.

In practise I'm reading through the rows of a 1000x1000 matrix one at a time and then the columns one at a time. In my head this should be about 2 million operations (I've heard 10^9 is usually the upper limit to avoid).

My code is here http://codeforces.net/contest/738/submission/22423987. Any help would be greatly appreciated.

Jon

P.S. It seems like my code is coming out without any kind of spacing. How do I correct this?

  • Vote: I like it
  • -13
  • Vote: I do not like it

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

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

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

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

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

please, you ruined the code. :)

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks for replying. I copy-pasted. The result is pretty freaking awful, but I'm not sure how to fix it. Could you tell me how to fix it? I did try googling for formatting help but couldn't find anything.

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

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

»
8 years ago, # |
  Vote: I like it +1 Vote: I do not like it

22461685 your code with just one additional line

»
8 years ago, # |
  Vote: I like it +5 Vote: I do not like it

And your code with 2 additional lines: 22461732