# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
112245 |
2019-05-18T04:49:31 Z |
user202729 |
Gap (APIO16_gap) |
C++17 |
|
61 ms |
1272 KB |
#include "gap.h"
#include<vector>
// #include<iostream>
using ll=long long;
ll findGap(int t, int n)
{
if(t==2){
ll a0,an;
MinMax(0,1000000000000000000LL,&a0,&an);
int n_gap=n-1;
ll const sum_gap=an-a0;
ll const min_gap=(sum_gap+n_gap-1)/n_gap;
// std::cerr<<"a0 an min_gap="<<a0<<' '<<an<<' '<<min_gap<<'\n';
// divide [a0..an] into [a0..a0+min_gap[, [a0+min_gap..a0+2*min_gap[, ...
// the last segment should contain an
ll _,prev_end; // max value of last segment
MinMax(a0+1,a0+min_gap-1,&_,&prev_end);
if(prev_end==-1)prev_end=a0;
ll start_next=a0+min_gap;
ll ans=min_gap;
while(an>=start_next){
ll cur_start,cur_end;
MinMax(start_next,start_next+min_gap-1,&cur_start,&cur_end);
if(cur_end!=-1){
ans=std::max(ans,cur_start-prev_end);
// std::cerr<<"sg "<<start_next<<' '<<start_next+min_gap-1<<' '
// <<"ans="<<cur_start<<'-'<<prev_end<<"="<<cur_start-prev_end<<"\n";
prev_end=cur_end;
} // otherwise this segment is empty
start_next+=min_gap;
}
return ans;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
13 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
16 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
17 |
Incorrect |
8 ms |
512 KB |
Output isn't correct |
18 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
19 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
20 |
Incorrect |
4 ms |
512 KB |
Output isn't correct |
21 |
Incorrect |
24 ms |
1144 KB |
Output isn't correct |
22 |
Incorrect |
23 ms |
1152 KB |
Output isn't correct |
23 |
Incorrect |
23 ms |
1024 KB |
Output isn't correct |
24 |
Incorrect |
23 ms |
1144 KB |
Output isn't correct |
25 |
Incorrect |
17 ms |
1152 KB |
Output isn't correct |
26 |
Incorrect |
24 ms |
1152 KB |
Output isn't correct |
27 |
Incorrect |
23 ms |
1152 KB |
Output isn't correct |
28 |
Incorrect |
23 ms |
1024 KB |
Output isn't correct |
29 |
Incorrect |
23 ms |
1152 KB |
Output isn't correct |
30 |
Incorrect |
12 ms |
1024 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
32 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
3 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
15 ms |
512 KB |
Output is correct |
17 |
Correct |
15 ms |
512 KB |
Output is correct |
18 |
Correct |
16 ms |
512 KB |
Output is correct |
19 |
Correct |
16 ms |
512 KB |
Output is correct |
20 |
Correct |
8 ms |
512 KB |
Output is correct |
21 |
Correct |
59 ms |
1144 KB |
Output is correct |
22 |
Correct |
59 ms |
1144 KB |
Output is correct |
23 |
Correct |
61 ms |
1144 KB |
Output is correct |
24 |
Correct |
59 ms |
1144 KB |
Output is correct |
25 |
Correct |
55 ms |
1152 KB |
Output is correct |
26 |
Correct |
60 ms |
1272 KB |
Output is correct |
27 |
Correct |
59 ms |
1244 KB |
Output is correct |
28 |
Correct |
60 ms |
1016 KB |
Output is correct |
29 |
Correct |
60 ms |
1016 KB |
Output is correct |
30 |
Correct |
31 ms |
1024 KB |
Output is correct |
31 |
Correct |
2 ms |
384 KB |
Output is correct |
32 |
Correct |
1 ms |
256 KB |
Output is correct |