# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
23500 |
2017-05-11T10:51:41 Z |
jun6873 |
Gap (APIO16_gap) |
C++14 |
|
99 ms |
8308 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
vector<lint> v;
lint findGap(int t, int n)
{
lint mn=0, mx=1e18;
if (t == 1) {
for (int i=0; i<(n+1)/2; i++) {
MinMax(mn, mx, &mn, &mx);
v.push_back(mn);
v.push_back(mx);
mn++; mx--;
}
} else {
MinMax(mn, mx, &mn, &mx);
v.push_back(mn);
v.push_back(mx);
lint k = (mx-mn+n-2)/(n-1)+1, now = mn, nxt = mn+k;
while (now <= mx) {
lint a, b;
MinMax(now, nxt-1, &a, &b);
now += k; nxt += k;
if (a>=0) v.push_back(a);
if (b>=0) v.push_back(b);
}
}
sort(v.begin(), v.end());
lint res = 0;
for (int i=0; i<v.size()-1; i++) res = max(res, v[i+1] - v[i]);
return res;
}
Compilation message
gap.cpp: In function 'lint findGap(int, int)':
gap.cpp:36:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<v.size()-1; i++) res = max(res, v[i+1] - v[i]);
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5148 KB |
Output is correct |
2 |
Correct |
0 ms |
5148 KB |
Output is correct |
3 |
Correct |
0 ms |
5148 KB |
Output is correct |
4 |
Correct |
0 ms |
5148 KB |
Output is correct |
5 |
Correct |
0 ms |
5148 KB |
Output is correct |
6 |
Correct |
0 ms |
5148 KB |
Output is correct |
7 |
Correct |
0 ms |
5148 KB |
Output is correct |
8 |
Correct |
0 ms |
5148 KB |
Output is correct |
9 |
Correct |
0 ms |
5148 KB |
Output is correct |
10 |
Correct |
0 ms |
5148 KB |
Output is correct |
11 |
Correct |
0 ms |
5148 KB |
Output is correct |
12 |
Correct |
0 ms |
5148 KB |
Output is correct |
13 |
Correct |
0 ms |
5148 KB |
Output is correct |
14 |
Correct |
0 ms |
5148 KB |
Output is correct |
15 |
Correct |
0 ms |
5148 KB |
Output is correct |
16 |
Correct |
13 ms |
5620 KB |
Output is correct |
17 |
Correct |
9 ms |
5620 KB |
Output is correct |
18 |
Correct |
13 ms |
5620 KB |
Output is correct |
19 |
Correct |
13 ms |
5620 KB |
Output is correct |
20 |
Correct |
9 ms |
5620 KB |
Output is correct |
21 |
Correct |
53 ms |
6772 KB |
Output is correct |
22 |
Correct |
53 ms |
6772 KB |
Output is correct |
23 |
Correct |
76 ms |
6772 KB |
Output is correct |
24 |
Correct |
53 ms |
6772 KB |
Output is correct |
25 |
Correct |
49 ms |
6772 KB |
Output is correct |
26 |
Correct |
53 ms |
6772 KB |
Output is correct |
27 |
Correct |
76 ms |
6772 KB |
Output is correct |
28 |
Correct |
49 ms |
6772 KB |
Output is correct |
29 |
Correct |
56 ms |
6772 KB |
Output is correct |
30 |
Correct |
49 ms |
6772 KB |
Output is correct |
31 |
Correct |
0 ms |
5148 KB |
Output is correct |
32 |
Correct |
0 ms |
5148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5148 KB |
Output is correct |
2 |
Correct |
0 ms |
5148 KB |
Output is correct |
3 |
Correct |
0 ms |
5148 KB |
Output is correct |
4 |
Correct |
0 ms |
5148 KB |
Output is correct |
5 |
Correct |
0 ms |
5148 KB |
Output is correct |
6 |
Correct |
0 ms |
5148 KB |
Output is correct |
7 |
Correct |
0 ms |
5148 KB |
Output is correct |
8 |
Correct |
0 ms |
5148 KB |
Output is correct |
9 |
Correct |
0 ms |
5148 KB |
Output is correct |
10 |
Correct |
0 ms |
5148 KB |
Output is correct |
11 |
Correct |
0 ms |
5148 KB |
Output is correct |
12 |
Correct |
0 ms |
5148 KB |
Output is correct |
13 |
Correct |
0 ms |
5148 KB |
Output is correct |
14 |
Correct |
0 ms |
5148 KB |
Output is correct |
15 |
Correct |
0 ms |
5292 KB |
Output is correct |
16 |
Correct |
19 ms |
5620 KB |
Output is correct |
17 |
Correct |
16 ms |
5620 KB |
Output is correct |
18 |
Correct |
16 ms |
5620 KB |
Output is correct |
19 |
Correct |
26 ms |
5620 KB |
Output is correct |
20 |
Correct |
9 ms |
5148 KB |
Output is correct |
21 |
Correct |
76 ms |
6772 KB |
Output is correct |
22 |
Correct |
99 ms |
6772 KB |
Output is correct |
23 |
Correct |
73 ms |
6772 KB |
Output is correct |
24 |
Correct |
73 ms |
6772 KB |
Output is correct |
25 |
Correct |
83 ms |
8308 KB |
Output is correct |
26 |
Correct |
83 ms |
6772 KB |
Output is correct |
27 |
Correct |
79 ms |
6772 KB |
Output is correct |
28 |
Correct |
86 ms |
6772 KB |
Output is correct |
29 |
Correct |
83 ms |
6772 KB |
Output is correct |
30 |
Correct |
49 ms |
5620 KB |
Output is correct |
31 |
Correct |
0 ms |
5148 KB |
Output is correct |
32 |
Correct |
0 ms |
5148 KB |
Output is correct |