답안 #875585

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
875585 2023-11-20T05:40:56 Z NeroZein Gap (APIO16_gap) C++17
0 / 100
809 ms 3868 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;
    if (s == 0) {
      break; 
    }
    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; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2496 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 Correct 1 ms 2392 KB Output is correct
11 Incorrect 7 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 5 ms 2392 KB Output isn't correct
15 Incorrect 10 ms 2520 KB Output isn't correct
16 Incorrect 124 ms 2628 KB Output isn't correct
17 Incorrect 113 ms 2568 KB Output isn't correct
18 Incorrect 113 ms 2588 KB Output isn't correct
19 Incorrect 125 ms 2580 KB Output isn't correct
20 Correct 3 ms 2792 KB Output is correct
21 Incorrect 544 ms 3868 KB Output isn't correct
22 Incorrect 516 ms 3616 KB Output isn't correct
23 Incorrect 537 ms 3620 KB Output isn't correct
24 Incorrect 522 ms 3624 KB Output isn't correct
25 Incorrect 779 ms 3624 KB Output isn't correct
26 Incorrect 537 ms 3628 KB Output isn't correct
27 Incorrect 527 ms 3620 KB Output isn't correct
28 Incorrect 567 ms 3628 KB Output isn't correct
29 Incorrect 531 ms 3624 KB Output isn't correct
30 Correct 15 ms 3548 KB Output is correct
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2396 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Partially correct 1 ms 2392 KB Partially correct
3 Partially correct 1 ms 2392 KB Partially correct
4 Partially correct 1 ms 2388 KB Partially correct
5 Partially correct 1 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 2404 KB Partially correct
9 Partially correct 1 ms 2392 KB Partially correct
10 Partially correct 1 ms 2392 KB Partially correct
11 Partially correct 5 ms 2392 KB Partially correct
12 Partially correct 5 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 9 ms 2392 KB Partially correct
16 Partially correct 113 ms 2680 KB Partially correct
17 Partially correct 118 ms 2592 KB Partially correct
18 Partially correct 111 ms 2580 KB Partially correct
19 Partially correct 111 ms 2588 KB Partially correct
20 Correct 4 ms 2792 KB Output is correct
21 Incorrect 526 ms 3628 KB Expected int32, but "3738663473" found
22 Incorrect 532 ms 3628 KB Expected int32, but "3734306730" found
23 Incorrect 530 ms 3628 KB Expected int32, but "3707831611" found
24 Incorrect 530 ms 3632 KB Expected int32, but "3741233199" found
25 Incorrect 809 ms 3620 KB Expected int32, but "10532484794" found
26 Incorrect 538 ms 3624 KB Expected int32, but "3729446733" found
27 Incorrect 532 ms 3868 KB Expected int32, but "3747709649" found
28 Incorrect 544 ms 3620 KB Expected int32, but "3747992178" found
29 Incorrect 517 ms 3640 KB Expected int32, but "3726314379" found
30 Partially correct 15 ms 3604 KB Partially correct
31 Partially correct 0 ms 2392 KB Partially correct
32 Partially correct 1 ms 2392 KB Partially correct