# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
240167 |
2020-06-18T10:35:44 Z |
b00n0rp |
Gap (APIO16_gap) |
C++17 |
|
84 ms |
3332 KB |
#include <gap.h>
#include<bits/stdc++.h>
using namespace std;
#define int long long
int findGap(signed T,signed N){
if(T == 1){
int l = 0,r = (int)(1e18);
vector<int> v;
while(v.size() < N){
int mn,mx;
MinMax(l,r,&mn,&mx);
v.push_back(mn);
if(mn != mx) v.push_back(mx);
l = mn+1;
r = mx-1;
}
sort(v.begin(),v.end());
int ans = 0;
for(int i = 1; i < v.size(); i ++){
ans = max(ans,v[i]-v[i-1]);
}
return ans;
}
else{
int l = 0,r = (int)(1e18);
int mn,mx;
MinMax(l,r,&mn,&mx);
int mans = (mx-mn+N-2)/(N-1);
vector<int> v;
v.push_back(mn);
v.push_back(mx);
l = mn+1;
r = mx-1;
while(l < r){
MinMax(l,min(l+mans-1,r),&mn,&mx);
l += mans;
if(mn != -1) v.push_back(mn);
if(mx != -1) v.push_back(mx);
}
sort(v.begin(),v.end());
int ans = 0;
for(int i = 1; i < v.size(); i ++){
ans = max(ans,v[i]-v[i-1]);
}
return ans;
}
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:11:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(v.size() < N){
~~~~~~~~~^~~
gap.cpp:21:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < v.size(); i ++){
~~^~~~~~~~~~
gap.cpp:44:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < v.size(); i ++){
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
20 ms |
928 KB |
Output is correct |
17 |
Correct |
18 ms |
896 KB |
Output is correct |
18 |
Correct |
19 ms |
896 KB |
Output is correct |
19 |
Correct |
20 ms |
1016 KB |
Output is correct |
20 |
Correct |
14 ms |
1024 KB |
Output is correct |
21 |
Correct |
69 ms |
2288 KB |
Output is correct |
22 |
Correct |
68 ms |
2288 KB |
Output is correct |
23 |
Correct |
68 ms |
2288 KB |
Output is correct |
24 |
Correct |
59 ms |
2288 KB |
Output is correct |
25 |
Correct |
51 ms |
2280 KB |
Output is correct |
26 |
Correct |
62 ms |
2304 KB |
Output is correct |
27 |
Correct |
59 ms |
2352 KB |
Output is correct |
28 |
Correct |
61 ms |
2288 KB |
Output is correct |
29 |
Correct |
60 ms |
2488 KB |
Output is correct |
30 |
Correct |
45 ms |
2260 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
21 ms |
896 KB |
Output is correct |
17 |
Correct |
20 ms |
896 KB |
Output is correct |
18 |
Correct |
23 ms |
920 KB |
Output is correct |
19 |
Correct |
21 ms |
896 KB |
Output is correct |
20 |
Correct |
12 ms |
512 KB |
Output is correct |
21 |
Correct |
73 ms |
2288 KB |
Output is correct |
22 |
Correct |
75 ms |
2280 KB |
Output is correct |
23 |
Correct |
79 ms |
2288 KB |
Output is correct |
24 |
Correct |
73 ms |
2416 KB |
Output is correct |
25 |
Correct |
69 ms |
3332 KB |
Output is correct |
26 |
Correct |
75 ms |
2416 KB |
Output is correct |
27 |
Correct |
74 ms |
2288 KB |
Output is correct |
28 |
Correct |
84 ms |
2264 KB |
Output is correct |
29 |
Correct |
74 ms |
2288 KB |
Output is correct |
30 |
Correct |
46 ms |
1528 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
4 ms |
384 KB |
Output is correct |