#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
#define VIS(it,con) for(auto it=con.begin();it!=con.end();++it)
#define MIN(x,y) (x=min(x,(y)))
#define MAX(x,y) (x=max(x,(y)))
#define REP(i,j,k) for(register int i=(j);i<(k);++i)
#define RREP(i,j,k) for(register int i=(j)-1;i>=(k);--i)
#define ALL(a) a.begin(),a.end()
#define MST(a,v) memset(a,(v),sizeof a)
#define pb push_back
typedef long long ll;
ll findGap(int t,int n){
ll mn,mx,res=0;
if(t==1){
vector<ll>num;
ll lb=0,rb=1e18;
REP(i,0,(n+1)/2){
MinMax(lb,rb,&mn,&mx);
num.pb(mn);
if(n%2==0||i<(n+1)/2)num.pb(mx);
lb=mn+1,rb=mx-1;
}
sort(ALL(num));
REP(i,1,n)MAX(res,num[i]-num[i-1]);
}else{
MinMax(0,1e18,&mn,&mx);
ll d=res=(mx-mn+n-2)/(n-1);
int lb=mn,last=mn;
while(1){
MinMax(lb,lb+d,&mn,&mx);
MAX(res,mn-last);
lb+=d+1;
last=mx;
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
3 ms |
384 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
3 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
17 ms |
1408 KB |
Output is correct |
17 |
Correct |
16 ms |
1408 KB |
Output is correct |
18 |
Correct |
17 ms |
1280 KB |
Output is correct |
19 |
Correct |
17 ms |
1408 KB |
Output is correct |
20 |
Correct |
15 ms |
1072 KB |
Output is correct |
21 |
Correct |
81 ms |
4080 KB |
Output is correct |
22 |
Correct |
66 ms |
4080 KB |
Output is correct |
23 |
Correct |
56 ms |
4080 KB |
Output is correct |
24 |
Correct |
62 ms |
4080 KB |
Output is correct |
25 |
Correct |
46 ms |
3440 KB |
Output is correct |
26 |
Correct |
69 ms |
4080 KB |
Output is correct |
27 |
Correct |
52 ms |
4080 KB |
Output is correct |
28 |
Correct |
52 ms |
4080 KB |
Output is correct |
29 |
Correct |
53 ms |
4208 KB |
Output is correct |
30 |
Correct |
62 ms |
3092 KB |
Output is correct |
31 |
Correct |
2 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2044 ms |
384 KB |
Time limit exceeded |
2 |
Execution timed out |
2028 ms |
384 KB |
Time limit exceeded |
3 |
Execution timed out |
2049 ms |
384 KB |
Time limit exceeded |
4 |
Execution timed out |
2032 ms |
256 KB |
Time limit exceeded |
5 |
Execution timed out |
2048 ms |
384 KB |
Time limit exceeded |
6 |
Execution timed out |
2051 ms |
256 KB |
Time limit exceeded |
7 |
Execution timed out |
2033 ms |
384 KB |
Time limit exceeded |
8 |
Execution timed out |
2047 ms |
384 KB |
Time limit exceeded |
9 |
Execution timed out |
2009 ms |
384 KB |
Time limit exceeded |
10 |
Execution timed out |
2035 ms |
384 KB |
Time limit exceeded |
11 |
Execution timed out |
2059 ms |
384 KB |
Time limit exceeded |
12 |
Execution timed out |
2057 ms |
384 KB |
Time limit exceeded |
13 |
Execution timed out |
2052 ms |
384 KB |
Time limit exceeded |
14 |
Execution timed out |
2068 ms |
384 KB |
Time limit exceeded |
15 |
Execution timed out |
2074 ms |
384 KB |
Time limit exceeded |
16 |
Execution timed out |
2059 ms |
896 KB |
Time limit exceeded |
17 |
Execution timed out |
2065 ms |
1024 KB |
Time limit exceeded |
18 |
Execution timed out |
2045 ms |
896 KB |
Time limit exceeded |
19 |
Execution timed out |
2005 ms |
896 KB |
Time limit exceeded |
20 |
Execution timed out |
2021 ms |
640 KB |
Time limit exceeded |
21 |
Execution timed out |
2060 ms |
2936 KB |
Time limit exceeded |
22 |
Execution timed out |
2069 ms |
2936 KB |
Time limit exceeded |
23 |
Execution timed out |
2054 ms |
2936 KB |
Time limit exceeded |
24 |
Execution timed out |
2043 ms |
2936 KB |
Time limit exceeded |
25 |
Execution timed out |
2059 ms |
2296 KB |
Time limit exceeded |
26 |
Execution timed out |
2037 ms |
2936 KB |
Time limit exceeded |
27 |
Execution timed out |
2071 ms |
2936 KB |
Time limit exceeded |
28 |
Execution timed out |
2033 ms |
2936 KB |
Time limit exceeded |
29 |
Execution timed out |
2045 ms |
2936 KB |
Time limit exceeded |
30 |
Execution timed out |
2051 ms |
1784 KB |
Time limit exceeded |
31 |
Execution timed out |
2019 ms |
256 KB |
Time limit exceeded |
32 |
Execution timed out |
2045 ms |
256 KB |
Time limit exceeded |