# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
897153 | 2024-01-02T15:53:49 Z | raul2008487 | Gap (APIO16_gap) | C++17 | 36 ms | 4040 KB |
#include<bits/stdc++.h> #include "gap.h" #define ll long long #define pll pair<ll,ll> #define vl vector<ll> #define pb push_back #define in insert #define all(v) v.begin(), v.end() #define fi first #define se second #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; long long findGap(int T, int N) { ll l, r, i, j, lo = 0, hi = 1000000000000000000, ans = 0, n = N; MinMax(lo, hi, &l, &r); if( T == 1 ){ vl v; v.pb(l); v.pb(r); while(l != r && v.size() < n){ lo = l + 1, hi = r - 1; MinMax(lo, hi, &l, &r); v.pb(l); v.pb(r); } sort(all(v)); for(i = 1; i<v.size(); i++){ ans = max(ans, (v[i] - v[i-1])); } return ans; } ll a, b, d1, d2, pw = (r - l) / n; while(l != r){ a = b = -1; while(a == -1){MinMax(l + 1, l + 1 + pw, &a, &b); pw <<= 1;} ans = max(ans, (a - l)); pw = ans; l = b; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 2392 KB | Output is correct |
3 | Correct | 0 ms | 2392 KB | Output is correct |
4 | Correct | 1 ms | 2388 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Correct | 1 ms | 2392 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2392 KB | Output is correct |
9 | Correct | 0 ms | 2392 KB | Output is correct |
10 | Correct | 1 ms | 2392 KB | Output is correct |
11 | Correct | 1 ms | 2392 KB | Output is correct |
12 | Correct | 1 ms | 2392 KB | Output is correct |
13 | Correct | 1 ms | 2392 KB | Output is correct |
14 | Correct | 1 ms | 2392 KB | Output is correct |
15 | Correct | 1 ms | 2392 KB | Output is correct |
16 | Correct | 8 ms | 2832 KB | Output is correct |
17 | Correct | 8 ms | 2844 KB | Output is correct |
18 | Correct | 8 ms | 2844 KB | Output is correct |
19 | Correct | 9 ms | 2844 KB | Output is correct |
20 | Correct | 7 ms | 2828 KB | Output is correct |
21 | Correct | 31 ms | 4040 KB | Output is correct |
22 | Correct | 31 ms | 3872 KB | Output is correct |
23 | Correct | 31 ms | 3992 KB | Output is correct |
24 | Correct | 31 ms | 3996 KB | Output is correct |
25 | Correct | 28 ms | 4020 KB | Output is correct |
26 | Correct | 34 ms | 3996 KB | Output is correct |
27 | Correct | 32 ms | 3964 KB | Output is correct |
28 | Correct | 31 ms | 3992 KB | Output is correct |
29 | Correct | 31 ms | 3916 KB | Output is correct |
30 | Correct | 26 ms | 4000 KB | Output is correct |
31 | Correct | 1 ms | 2392 KB | Output is correct |
32 | Correct | 0 ms | 2392 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 0 ms | 2392 KB | Output is correct |
3 | Correct | 1 ms | 2392 KB | Output is correct |
4 | Correct | 0 ms | 2392 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Correct | 1 ms | 2392 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2392 KB | Output is correct |
9 | Correct | 0 ms | 2392 KB | Output is correct |
10 | Correct | 1 ms | 2392 KB | Output is correct |
11 | Correct | 1 ms | 2392 KB | Output is correct |
12 | Correct | 1 ms | 2392 KB | Output is correct |
13 | Correct | 1 ms | 2392 KB | Output is correct |
14 | Correct | 1 ms | 2392 KB | Output is correct |
15 | Correct | 1 ms | 2392 KB | Output is correct |
16 | Correct | 5 ms | 2752 KB | Output is correct |
17 | Correct | 5 ms | 2584 KB | Output is correct |
18 | Correct | 5 ms | 2736 KB | Output is correct |
19 | Correct | 5 ms | 2584 KB | Output is correct |
20 | Correct | 4 ms | 2572 KB | Output is correct |
21 | Correct | 16 ms | 2820 KB | Output is correct |
22 | Correct | 17 ms | 2812 KB | Output is correct |
23 | Correct | 17 ms | 2848 KB | Output is correct |
24 | Correct | 16 ms | 2856 KB | Output is correct |
25 | Correct | 36 ms | 2844 KB | Output is correct |
26 | Correct | 17 ms | 2848 KB | Output is correct |
27 | Correct | 17 ms | 3004 KB | Output is correct |
28 | Correct | 17 ms | 2856 KB | Output is correct |
29 | Correct | 16 ms | 2852 KB | Output is correct |
30 | Correct | 13 ms | 2848 KB | Output is correct |
31 | Correct | 1 ms | 2392 KB | Output is correct |
32 | Correct | 0 ms | 2392 KB | Output is correct |