wnmrmr's blog

By wnmrmr, history, 12 months ago, In English

Hi, if you compare this submission (296ms) with this one (3025ms), this is the difference:

I think this is crazy because g is a vector<vector<int>> with size 3 * 10^5 with at most 3 * 10^5 entries, and the function build that returns g is called once in the program. This huge time difference is the same on both 64-bit C++ compilers, but it is not present in the 32-bit C++ compiler.

UPD: Calling the function build twice solves the problem

  1. Normal submission (3041ms)
  2. Changed submission (327ms)

  • Vote: I like it
  • +61
  • Vote: I do not like it

| Write comment?
»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
12 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Looks like the problem is in tuple. Removed it and got 300 ms: link

Would be nice to know, why it happens.

»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
12 months ago, # |
  Vote: I like it +42 Vote: I do not like it

So $$$x = 3000$$$ and $$$2x = 300$$$? Hmm...

»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Probably that particular version of compiler doesn't handle captures of structured bindings well.