kingofnumbers's blog

By kingofnumbers, 11 years ago, In English

Hi, Just take look how I solved 242E — XOR on Segment

here is my code

the time limit for this problem is 4000ms and the running time for my code is 4000ms :) :] :D

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

»
11 years ago, # |
  Vote: I like it +7 Vote: I do not like it

You are really king of numbers :D Nice submit!

»
11 years ago, # |
  Vote: I like it +12 Vote: I do not like it

nice (:

»
11 years ago, # |
  Vote: I like it +13 Vote: I do not like it

:|

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

Same kind of thing happened on SRM 543. A loop from 1 to 4*10^9 passed system tests(and hacks) within 2 secs. link

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

I guess the 'count' and 'tmp' variables are used to reduce additions to 'sum', which is long long. Nice work!

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

I think the major reason is compiler optimisation. It's so cool what a compiler can actually do :).

»
11 years ago, # |
Rev. 3   Vote: I like it +5 Vote: I do not like it

Weak test case only, try 10^5 query like this

1 1 10^5
2 1 10^5 1
1 1 10^5
2 1 10^5 2
......

TLE please

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

    I am sure that there was such test. I just checked on my PC, solution really solves it in about 4 seconds.

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

      No TLE :-ss can you explain why ??? 10^10 solved in 4s with code like this ??

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

    look at test 38 , similar to this and solved in 4s.

»
11 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Why the code is correct? Why not TL?