# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
107324 |
2019-04-23T10:35:04 Z |
maruii |
Gap (APIO16_gap) |
C++14 |
|
93 ms |
4332 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int T, int N){
long long mn, mx, s=0, e=1e18, ans = 0;
if(T==1){
int i=0, j=N-1;
vector<long long> vec(N);
while(i<j){
MinMax(s, e, &mn, &mx);
vec[i++] = mn, vec[j--] = mx;
s = mn+1, e = mx-1;
}
for(int i=1; i<N; ++i) ans = max(ans, abs(vec[i]-vec[i-1]));
return ans;
}
MinMax(0, 1e18, &mn, &mx);
s = mn, e = mx;
long long d = (e-s)/(N-1)+1;
vector<pair<long long, long long> > vec;
bool flag = 0;
for(int i=1; i<N; ++i){
MinMax(s+(i-1)*d, s+i*d-1, &mn, &mx);
if(mn != -1) vec.emplace_back(mn, mx);
}
if(!flag) return d;
for(int i=1; i<vec.size(); ++i) ans = max(ans, vec[i].first - vec[i-1].second);
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:28:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1; i<vec.size(); ++i) ans = max(ans, vec[i].first - vec[i-1].second);
~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
3 ms |
412 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
14 ms |
1144 KB |
Output is correct |
17 |
Correct |
13 ms |
1024 KB |
Output is correct |
18 |
Correct |
19 ms |
1112 KB |
Output is correct |
19 |
Correct |
16 ms |
1016 KB |
Output is correct |
20 |
Correct |
12 ms |
888 KB |
Output is correct |
21 |
Correct |
54 ms |
3652 KB |
Output is correct |
22 |
Correct |
73 ms |
3576 KB |
Output is correct |
23 |
Correct |
48 ms |
3576 KB |
Output is correct |
24 |
Correct |
53 ms |
3576 KB |
Output is correct |
25 |
Correct |
63 ms |
3036 KB |
Output is correct |
26 |
Correct |
53 ms |
3576 KB |
Output is correct |
27 |
Correct |
61 ms |
3576 KB |
Output is correct |
28 |
Correct |
60 ms |
3576 KB |
Output is correct |
29 |
Correct |
63 ms |
3704 KB |
Output is correct |
30 |
Correct |
42 ms |
2432 KB |
Output is correct |
31 |
Correct |
3 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
300 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
356 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
16 |
Incorrect |
17 ms |
1280 KB |
Output isn't correct |
17 |
Incorrect |
18 ms |
1280 KB |
Output isn't correct |
18 |
Incorrect |
22 ms |
1280 KB |
Output isn't correct |
19 |
Incorrect |
20 ms |
1280 KB |
Output isn't correct |
20 |
Incorrect |
9 ms |
640 KB |
Output isn't correct |
21 |
Incorrect |
74 ms |
3972 KB |
Output isn't correct |
22 |
Incorrect |
86 ms |
3952 KB |
Output isn't correct |
23 |
Incorrect |
73 ms |
3956 KB |
Output isn't correct |
24 |
Incorrect |
93 ms |
4032 KB |
Output isn't correct |
25 |
Incorrect |
65 ms |
4332 KB |
Output isn't correct |
26 |
Incorrect |
74 ms |
4052 KB |
Output isn't correct |
27 |
Incorrect |
84 ms |
3952 KB |
Output isn't correct |
28 |
Incorrect |
70 ms |
3952 KB |
Output isn't correct |
29 |
Incorrect |
80 ms |
3952 KB |
Output isn't correct |
30 |
Incorrect |
33 ms |
2136 KB |
Output isn't correct |
31 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
32 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |