# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
944620 |
2024-03-13T01:57:15 Z |
wii |
Gap (APIO16_gap) |
C++17 |
|
52 ms |
7832 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, t;
vector<ll> num;
void dnc(ll l, ll r) {
if (l > r)
return;
if (t == 1) {
ll mn = -1, mx = -1;
if (num.size() < n) MinMax(l, r, &mn, &mx);
if (mn == -1) return;
dnc(mn + 1, mx - 1);
num.push_back(mn);
num.push_back(mx);
return;
}
ll mid = (l + r) >> 1;
ll mn = -1, mx = -1;
MinMax(l, mid, &mn, &mx);
if (mn != -1) {
num.push_back(mn);
num.push_back(mx);
dnc(mn + 1, mx - 1);
dnc(mid + 1, r);
return;
}
if (mid + 1 <= r) {
MinMax(mid, r, &mn, &mx);
if (mn != -1) {
num.push_back(mn);
num.push_back(mx);
dnc(mn + 1, mx - 1);
}
}
}
ll findGap(int T, int N) {
n = N; t = T;
dnc(0, 1e18);
sort(num.begin(), num.end());
ll res = 0;
for (int i = 1; i < num.size(); ++i)
res = max(res, num[i] - num[i - 1]);
return res;
}
Compilation message
gap.cpp: In function 'void dnc(ll, ll)':
gap.cpp:15:24: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
15 | if (num.size() < n) MinMax(l, r, &mn, &mx);
| ~~~~~~~~~~~^~~
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:57:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | for (int i = 1; i < num.size(); ++i)
| ~~^~~~~~~~~~~~
gap.cpp:57:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
57 | for (int i = 1; i < num.size(); ++i)
| ^~~
gap.cpp:60:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
60 | return res;
| ^~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Correct |
0 ms |
2392 KB |
Output is correct |
3 |
Correct |
2 ms |
2392 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is 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 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
16 |
Incorrect |
10 ms |
3868 KB |
Output isn't correct |
17 |
Incorrect |
8 ms |
3868 KB |
Output isn't correct |
18 |
Incorrect |
9 ms |
3868 KB |
Output isn't correct |
19 |
Incorrect |
9 ms |
3864 KB |
Output isn't correct |
20 |
Correct |
7 ms |
3848 KB |
Output is correct |
21 |
Incorrect |
34 ms |
7832 KB |
Output isn't correct |
22 |
Incorrect |
34 ms |
7828 KB |
Output isn't correct |
23 |
Incorrect |
39 ms |
7700 KB |
Output isn't correct |
24 |
Incorrect |
35 ms |
7816 KB |
Output isn't correct |
25 |
Incorrect |
30 ms |
7828 KB |
Output isn't correct |
26 |
Incorrect |
35 ms |
7828 KB |
Output isn't correct |
27 |
Incorrect |
34 ms |
7828 KB |
Output isn't correct |
28 |
Incorrect |
33 ms |
7828 KB |
Output isn't correct |
29 |
Incorrect |
34 ms |
7824 KB |
Output isn't correct |
30 |
Correct |
28 ms |
7828 KB |
Output is correct |
31 |
Correct |
1 ms |
2392 KB |
Output is correct |
32 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2392 KB |
Output is correct |
2 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
3 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
6 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
7 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
8 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
9 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
10 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
11 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
12 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
13 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
14 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
15 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
16 |
Partially correct |
12 ms |
2964 KB |
Partially correct |
17 |
Partially correct |
13 ms |
2964 KB |
Partially correct |
18 |
Partially correct |
13 ms |
2968 KB |
Partially correct |
19 |
Partially correct |
15 ms |
2964 KB |
Partially correct |
20 |
Partially correct |
10 ms |
3204 KB |
Partially correct |
21 |
Partially correct |
52 ms |
4000 KB |
Partially correct |
22 |
Partially correct |
52 ms |
3996 KB |
Partially correct |
23 |
Partially correct |
50 ms |
3980 KB |
Partially correct |
24 |
Partially correct |
51 ms |
3896 KB |
Partially correct |
25 |
Partially correct |
49 ms |
5004 KB |
Partially correct |
26 |
Partially correct |
52 ms |
3968 KB |
Partially correct |
27 |
Partially correct |
51 ms |
4040 KB |
Partially correct |
28 |
Partially correct |
51 ms |
3948 KB |
Partially correct |
29 |
Partially correct |
52 ms |
3900 KB |
Partially correct |
30 |
Partially correct |
37 ms |
5004 KB |
Partially correct |
31 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
32 |
Correct |
1 ms |
2392 KB |
Output is correct |