#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){
l=new long long();
r=new long long();
MinMax(1, inf, l,r);
q.push({l[0],r[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 |
Runtime error |
1104 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
4 |
Runtime error |
1200 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
6 |
Correct |
1 ms |
2388 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
9 |
Correct |
0 ms |
2392 KB |
Output is correct |
10 |
Correct |
0 ms |
2392 KB |
Output is correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Correct |
1 ms |
2392 KB |
Output is correct |
13 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
14 |
Correct |
1 ms |
2392 KB |
Output is correct |
15 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
16 |
Incorrect |
6 ms |
2928 KB |
Output isn't correct |
17 |
Correct |
6 ms |
2904 KB |
Output is correct |
18 |
Incorrect |
7 ms |
2756 KB |
Output isn't correct |
19 |
Correct |
6 ms |
2904 KB |
Output is correct |
20 |
Correct |
2 ms |
2392 KB |
Output is correct |
21 |
Incorrect |
46 ms |
5832 KB |
Output isn't correct |
22 |
Execution timed out |
3091 ms |
282924 KB |
Time limit exceeded |
23 |
Incorrect |
22 ms |
3800 KB |
Output isn't correct |
24 |
Correct |
34 ms |
4044 KB |
Output is correct |
25 |
Incorrect |
95 ms |
12548 KB |
Output isn't correct |
26 |
Correct |
28 ms |
4300 KB |
Output is correct |
27 |
Correct |
25 ms |
4052 KB |
Output is correct |
28 |
Correct |
25 ms |
4052 KB |
Output is correct |
29 |
Incorrect |
25 ms |
3808 KB |
Output isn't correct |
30 |
Correct |
15 ms |
2648 KB |
Output is correct |
31 |
Correct |
0 ms |
2392 KB |
Output is correct |
32 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2392 KB |
Output is correct |
2 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
3 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
6 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
7 |
Partially correct |
0 ms |
2392 KB |
Partially correct |
8 |
Runtime error |
1336 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
10 |
Partially correct |
1 ms |
2392 KB |
Partially correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Runtime error |
1576 ms |
524288 KB |
Execution killed with signal 9 |
13 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Partially correct |
2 ms |
2648 KB |
Partially correct |
16 |
Incorrect |
7 ms |
2996 KB |
Output isn't correct |
17 |
Incorrect |
9 ms |
2948 KB |
Output isn't correct |
18 |
Partially correct |
6 ms |
2904 KB |
Partially correct |
19 |
Partially correct |
6 ms |
2904 KB |
Partially correct |
20 |
Partially correct |
3 ms |
2392 KB |
Partially correct |
21 |
Partially correct |
26 ms |
4052 KB |
Partially correct |
22 |
Incorrect |
19 ms |
3540 KB |
Output isn't correct |
23 |
Partially correct |
26 ms |
4052 KB |
Partially correct |
24 |
Partially correct |
31 ms |
4044 KB |
Partially correct |
25 |
Partially correct |
96 ms |
12480 KB |
Partially correct |
26 |
Incorrect |
26 ms |
3864 KB |
Output isn't correct |
27 |
Incorrect |
33 ms |
4044 KB |
Output isn't correct |
28 |
Incorrect |
26 ms |
4176 KB |
Output isn't correct |
29 |
Partially correct |
28 ms |
4044 KB |
Partially correct |
30 |
Partially correct |
7 ms |
2648 KB |
Partially correct |
31 |
Correct |
0 ms |
2392 KB |
Output is correct |
32 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |