답안 #668332

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
668332 2022-12-03T16:25:51 Z birthdaycake Gap (APIO16_gap) C++17
0 / 100
51 ms 3272 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e18;

long long findGap(int T, int N){
    long long l = 0, r = 0, mn = 0, mx = 0;
    MinMax(1, maxn, &mn, &mx);
    l = mn; r = mx;
    long long sz = (r - l + 1) / (N - 1), j = 0;
    vector<pair<long long,long>>d;
    for(j = l; j <= r; j += sz+1){
        MinMax(j, j + sz, &mn, &mx);
        d.push_back({mn, mx});
    }
    MinMax(j, r, &mn, &mx);
    d.push_back({mn, mx});
    long long ans = sz;
    mx = d[0].second;
    for(int i = 1; i < (int)d.size(); i++){
        if(d[i].first != -1){
            ans = max(ans, d[i].first - mx);
            mx = d[i].second;
        }
        
    }
    return ans;
}

Compilation message

gap.cpp:4:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    4 | const int maxn = 1e18;
      |                  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
4 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
6 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
8 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
9 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
16 Runtime error 5 ms 424 KB Execution failed because the return code was nonzero
17 Runtime error 5 ms 432 KB Execution failed because the return code was nonzero
18 Runtime error 6 ms 472 KB Execution failed because the return code was nonzero
19 Runtime error 5 ms 464 KB Execution failed because the return code was nonzero
20 Runtime error 6 ms 1100 KB Execution failed because the return code was nonzero
21 Runtime error 28 ms 996 KB Execution failed because the return code was nonzero
22 Runtime error 20 ms 1048 KB Execution failed because the return code was nonzero
23 Runtime error 23 ms 1060 KB Execution failed because the return code was nonzero
24 Runtime error 20 ms 988 KB Execution failed because the return code was nonzero
25 Runtime error 34 ms 3260 KB Execution failed because the return code was nonzero
26 Runtime error 22 ms 996 KB Execution failed because the return code was nonzero
27 Runtime error 21 ms 1080 KB Execution failed because the return code was nonzero
28 Runtime error 27 ms 1060 KB Execution failed because the return code was nonzero
29 Runtime error 22 ms 972 KB Execution failed because the return code was nonzero
30 Runtime error 32 ms 3244 KB Execution failed because the return code was nonzero
31 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
4 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
6 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
9 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
10 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
14 Runtime error 0 ms 336 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
16 Runtime error 6 ms 464 KB Execution failed because the return code was nonzero
17 Runtime error 6 ms 400 KB Execution failed because the return code was nonzero
18 Runtime error 6 ms 428 KB Execution failed because the return code was nonzero
19 Runtime error 7 ms 464 KB Execution failed because the return code was nonzero
20 Runtime error 7 ms 1100 KB Execution failed because the return code was nonzero
21 Runtime error 26 ms 1052 KB Execution failed because the return code was nonzero
22 Runtime error 19 ms 1064 KB Execution failed because the return code was nonzero
23 Runtime error 26 ms 1056 KB Execution failed because the return code was nonzero
24 Runtime error 18 ms 1068 KB Execution failed because the return code was nonzero
25 Runtime error 51 ms 3200 KB Execution failed because the return code was nonzero
26 Runtime error 26 ms 980 KB Execution failed because the return code was nonzero
27 Runtime error 21 ms 1060 KB Execution failed because the return code was nonzero
28 Runtime error 19 ms 1072 KB Execution failed because the return code was nonzero
29 Runtime error 26 ms 1108 KB Execution failed because the return code was nonzero
30 Runtime error 29 ms 3272 KB Execution failed because the return code was nonzero
31 Runtime error 1 ms 216 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 212 KB Execution failed because the return code was nonzero