Submission #875584

# Submission time Handle Problem Language Result Execution time Memory
875584 2023-11-20T05:38:16 Z NeroZein Gap (APIO16_gap) C++17
0 / 100
742 ms 3880 KB
#include "gap.h"
#include "bits/stdc++.h"

using namespace std; 

long long findGap(int T, int N) {
  long long ret = 0; 
  vector<long long> a(N + 1);
  MinMax(0, LLONG_MAX, &a[1], &a[N]); 
  for (int i = 1; i < N - 1; ++i) {//find i + 1
    if (a[i] == a[N]) {
      break; 
    }
    long long s = (a[N] - a[i] + N - i - 1) / (N - i) - 1;
    long long z = 0; 
    MinMax(a[i] + 1, a[i] + s, &z, &z); 
    if (z == -1) {
      long long t = 0; 
      for (int j = 60; j >= 0; --j) {
        if ((1LL << j) > a[N]) {
          continue; 
        }
        MinMax(a[i] + 1, a[i] + t + (1LL << j), &z, &z);
        if (z == -1) {
          t += (1LL << j); 
        }
      }
      ret = max(ret, t + 1); 
      a[i + 1] = a[i] + t + 1; 
    } else {
      a[i + 1] = z; 
    }
  }
  if (a[N - 1] != 0) {
    ret = max(ret, a[N] - a[N - 1]);     
  }
  return ret; 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 2392 KB Output isn't correct
3 Incorrect 0 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 0 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2392 KB Output isn't correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
11 Incorrect 5 ms 2392 KB Output isn't correct
12 Incorrect 5 ms 2392 KB Output isn't correct
13 Incorrect 5 ms 2392 KB Output isn't correct
14 Incorrect 6 ms 2648 KB Output isn't correct
15 Incorrect 7 ms 2392 KB Output isn't correct
16 Incorrect 105 ms 2580 KB Output isn't correct
17 Incorrect 104 ms 2588 KB Output isn't correct
18 Incorrect 107 ms 2584 KB Output isn't correct
19 Incorrect 110 ms 2636 KB Output isn't correct
20 Runtime error 3 ms 2572 KB Execution failed because the return code was nonzero
21 Incorrect 480 ms 3624 KB Output isn't correct
22 Incorrect 492 ms 3624 KB Output isn't correct
23 Incorrect 486 ms 3596 KB Output isn't correct
24 Incorrect 485 ms 3624 KB Output isn't correct
25 Incorrect 729 ms 3608 KB Output isn't correct
26 Incorrect 483 ms 3624 KB Output isn't correct
27 Incorrect 486 ms 3620 KB Output isn't correct
28 Incorrect 489 ms 3616 KB Output isn't correct
29 Incorrect 485 ms 3624 KB Output isn't correct
30 Runtime error 15 ms 3624 KB Execution failed because the return code was nonzero
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Partially correct 0 ms 2392 KB Partially correct
3 Partially correct 1 ms 2644 KB Partially correct
4 Partially correct 0 ms 2392 KB Partially correct
5 Partially correct 0 ms 2392 KB Partially correct
6 Partially correct 1 ms 2392 KB Partially correct
7 Partially correct 1 ms 2392 KB Partially correct
8 Partially correct 1 ms 2392 KB Partially correct
9 Partially correct 1 ms 2392 KB Partially correct
10 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
11 Partially correct 5 ms 2392 KB Partially correct
12 Partially correct 6 ms 2392 KB Partially correct
13 Partially correct 5 ms 2392 KB Partially correct
14 Partially correct 5 ms 2392 KB Partially correct
15 Partially correct 7 ms 2392 KB Partially correct
16 Partially correct 105 ms 2580 KB Partially correct
17 Partially correct 125 ms 2576 KB Partially correct
18 Partially correct 103 ms 2588 KB Partially correct
19 Partially correct 103 ms 2580 KB Partially correct
20 Runtime error 3 ms 2804 KB Execution failed because the return code was nonzero
21 Incorrect 499 ms 3604 KB Expected int32, but "3738663473" found
22 Incorrect 479 ms 3620 KB Expected int32, but "3734306730" found
23 Incorrect 481 ms 3452 KB Expected int32, but "3707831611" found
24 Incorrect 485 ms 3880 KB Expected int32, but "3741233199" found
25 Incorrect 742 ms 3620 KB Expected int32, but "10532484794" found
26 Incorrect 489 ms 3624 KB Expected int32, but "3729446733" found
27 Incorrect 484 ms 3636 KB Expected int32, but "3747709649" found
28 Incorrect 483 ms 3512 KB Expected int32, but "3747992178" found
29 Incorrect 481 ms 3792 KB Expected int32, but "3726314379" found
30 Runtime error 14 ms 3620 KB Execution failed because the return code was nonzero
31 Partially correct 1 ms 2392 KB Partially correct
32 Runtime error 1 ms 2388 KB Execution failed because the return code was nonzero