#include<bits/stdc++.h>
#include "gap.h"
#define MAXN 600007
using namespace std;
struct interval{
long long from,to;
inline friend bool operator < (interval fr,interval sc){
return fr.to-fr.from<sc.to-sc.from;
}
};
priority_queue<interval> q;
interval check(long long l,long long r){
if(l+1==r)return {-1,-1};
long long mid=(l+r)/2;
long long *ll,*rr,*lt,*rt;
ll=new long long();
rr=new long long();
lt=new long long();
rt=new long long();
MinMax(l+1,mid, ll,rr);
MinMax(mid,r-1, lt,rt);
return {*rr,*lt};
}
const long long inf=1e18;
long long *l,*r;
long long findGap(int T, int N){
while(!q.empty())q.pop();
l=new long long();
r=new long long();
MinMax(1, inf, l,r);
q.push({*l,*r});
return 0;
while(true){
interval s=check(q.top().from,q.top().to);
if(s.from==-1)return q.top().to-q.top().from;
interval z=q.top();
q.pop();
q.push({z.from,s.from});
if(s.from!=s.to)q.push(s);
q.push({s.to,z.to});
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
16 |
Incorrect |
4 ms |
2392 KB |
Output isn't correct |
17 |
Incorrect |
3 ms |
2532 KB |
Output isn't correct |
18 |
Incorrect |
3 ms |
2392 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
2392 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
2392 KB |
Output isn't correct |
21 |
Incorrect |
12 ms |
2648 KB |
Output isn't correct |
22 |
Incorrect |
14 ms |
2816 KB |
Output isn't correct |
23 |
Incorrect |
12 ms |
2648 KB |
Output isn't correct |
24 |
Incorrect |
12 ms |
2648 KB |
Output isn't correct |
25 |
Incorrect |
10 ms |
2648 KB |
Output isn't correct |
26 |
Incorrect |
13 ms |
2648 KB |
Output isn't correct |
27 |
Incorrect |
12 ms |
2648 KB |
Output isn't correct |
28 |
Incorrect |
14 ms |
2760 KB |
Output isn't correct |
29 |
Incorrect |
14 ms |
2648 KB |
Output isn't correct |
30 |
Incorrect |
8 ms |
2648 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
32 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
16 |
Incorrect |
5 ms |
2392 KB |
Output isn't correct |
17 |
Incorrect |
4 ms |
2392 KB |
Output isn't correct |
18 |
Incorrect |
6 ms |
2392 KB |
Output isn't correct |
19 |
Incorrect |
5 ms |
2512 KB |
Output isn't correct |
20 |
Incorrect |
4 ms |
2392 KB |
Output isn't correct |
21 |
Incorrect |
19 ms |
2692 KB |
Output isn't correct |
22 |
Incorrect |
13 ms |
2648 KB |
Output isn't correct |
23 |
Incorrect |
19 ms |
2648 KB |
Output isn't correct |
24 |
Incorrect |
12 ms |
2648 KB |
Output isn't correct |
25 |
Incorrect |
10 ms |
2648 KB |
Output isn't correct |
26 |
Incorrect |
13 ms |
2648 KB |
Output isn't correct |
27 |
Incorrect |
22 ms |
2648 KB |
Output isn't correct |
28 |
Incorrect |
13 ms |
2768 KB |
Output isn't correct |
29 |
Incorrect |
24 ms |
2804 KB |
Output isn't correct |
30 |
Incorrect |
8 ms |
2648 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |