Блог пользователя rachitiitr

Автор rachitiitr, история, 8 лет назад, По-английски

Problem: http://codeforces.com/contest/677/problem/B
The user is doing rem = a[i];
while(rem) {if (rem >= k) rem -= k; }
See the image for his code:
http://codeforces.com/predownloaded/0a/2d/0a2d8f1ff5bca1d364d6224513611c725c9a0df2.png
If I set k = 1, and rem = 10^9 Clearly it will timeout, but I was given an unsuccessful hacking attempt. Why?

Test case I gave:
1 1000000000 1
1000000000
Result-> Unsuccessful

I thought compiler would be doing some optimizations. So turned k to 2. Still it gave unsuccessful hacking attempt. IInd Test case I gave:
1 1000000000 2
1000000000
Result-> Unsuccessful

UPD -> His code got TLE after the final system checks. -_- http://codeforces.com/contest/677/submission/18191327

This is a great way to suffer a loss of 200 points.

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Obvious answer — fast servers ( > 1e9 cycles per sec). There have been many posts/comments regarding this.

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Even if you would have given the value of n around 10-15 instead of 1 with big a[i]'s, your hack might be successful.

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Might be due to Fast CF server. Code runs on this test case in 624ms when I tried it in CUSTOM INVOCATION.

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

1e9 simple operations = ~1 second.

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

On servers 10^9 fast operations go for ~0.6 seconds While 2*10^9 operations took around 1.2 seconds You should have provided test case as: 2 1000000000 1 1000000000 1000000000 To get a successful hacking attempt

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thanks everybody for letting me know this. It was otherwise indigestible.