kingofnumbers's blog

By kingofnumbers, 12 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

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

You are really king of numbers :D Nice submit!

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

nice (:

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

:|

»
12 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

»
12 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!

»
12 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 :).

»
12 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

  • »
    »
    12 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.

    • »
      »
      »
      12 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 ??

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

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

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

Why the code is correct? Why not TL?