#include "gap.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll ma,u1,u2,ce,L1,R1,L2,R2,L,R;
priority_queue<pair<ll,pair<ll,ll> > >pq;
long long findGap(int T, int N)
{
ma=0;
MinMax(0,(ll)1e18,&L,&R);
pq.push(mp(R-L,mp(L,R)));
map<ll,map<ll,bool> >me;
while(!pq.empty())
{
u1=pq.top().se.fi;
u2=pq.top().se.se;
pq.pop();
ce=(u1+u2)/2;
//cout<<me[u1][u2]<<"\n";
if(u2-u1<=ma||me[u1][u2]==1)
continue;
me[u1][u2]=1;
//cout<<u1<<" "<<u2<<"\n";
if(u1+1==u2)
{
ma=max(ma,1LL);
continue;
}
MinMax(u1,ce,&L1,&R1);
if(R1!=u2)
MinMax(ce+1,u2,&L2,&R2);
ma=max(ma,L2-R1);
if(R1-L1>ma)
pq.push(mp(R1-L1,mp(L1,R1)));
if(R2-L2>ma)
pq.push(mp(R2-L2,mp(L2,R2)));
}
return ma;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
356 KB |
Output isn't correct |
3 |
Correct |
2 ms |
560 KB |
Output is correct |
4 |
Incorrect |
2 ms |
560 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
560 KB |
Output isn't correct |
6 |
Correct |
2 ms |
560 KB |
Output is correct |
7 |
Correct |
2 ms |
560 KB |
Output is correct |
8 |
Correct |
2 ms |
588 KB |
Output is correct |
9 |
Correct |
2 ms |
588 KB |
Output is correct |
10 |
Correct |
2 ms |
588 KB |
Output is correct |
11 |
Correct |
3 ms |
588 KB |
Output is correct |
12 |
Correct |
3 ms |
588 KB |
Output is correct |
13 |
Correct |
3 ms |
588 KB |
Output is correct |
14 |
Correct |
3 ms |
588 KB |
Output is correct |
15 |
Incorrect |
4 ms |
844 KB |
Output isn't correct |
16 |
Correct |
17 ms |
1236 KB |
Output is correct |
17 |
Correct |
15 ms |
1236 KB |
Output is correct |
18 |
Correct |
14 ms |
1236 KB |
Output is correct |
19 |
Correct |
15 ms |
1236 KB |
Output is correct |
20 |
Correct |
5 ms |
1236 KB |
Output is correct |
21 |
Correct |
56 ms |
2412 KB |
Output is correct |
22 |
Correct |
54 ms |
2412 KB |
Output is correct |
23 |
Correct |
64 ms |
2412 KB |
Output is correct |
24 |
Correct |
55 ms |
2412 KB |
Output is correct |
25 |
Incorrect |
152 ms |
9252 KB |
Output isn't correct |
26 |
Correct |
55 ms |
9252 KB |
Output is correct |
27 |
Correct |
56 ms |
9252 KB |
Output is correct |
28 |
Correct |
54 ms |
9252 KB |
Output is correct |
29 |
Correct |
56 ms |
9252 KB |
Output is correct |
30 |
Correct |
16 ms |
9252 KB |
Output is correct |
31 |
Correct |
2 ms |
9252 KB |
Output is correct |
32 |
Correct |
2 ms |
9252 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
2 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
3 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
4 |
Correct |
2 ms |
9252 KB |
Output is correct |
5 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
6 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
7 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
8 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
9 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
10 |
Partially correct |
2 ms |
9252 KB |
Partially correct |
11 |
Partially correct |
3 ms |
9252 KB |
Partially correct |
12 |
Partially correct |
3 ms |
9252 KB |
Partially correct |
13 |
Partially correct |
3 ms |
9252 KB |
Partially correct |
14 |
Partially correct |
3 ms |
9252 KB |
Partially correct |
15 |
Partially correct |
4 ms |
9252 KB |
Partially correct |
16 |
Partially correct |
16 ms |
9252 KB |
Partially correct |
17 |
Partially correct |
16 ms |
9252 KB |
Partially correct |
18 |
Partially correct |
21 ms |
9252 KB |
Partially correct |
19 |
Partially correct |
14 ms |
9252 KB |
Partially correct |
20 |
Partially correct |
5 ms |
9252 KB |
Partially correct |
21 |
Partially correct |
53 ms |
9252 KB |
Partially correct |
22 |
Partially correct |
53 ms |
9252 KB |
Partially correct |
23 |
Partially correct |
54 ms |
9252 KB |
Partially correct |
24 |
Partially correct |
53 ms |
9252 KB |
Partially correct |
25 |
Partially correct |
147 ms |
9340 KB |
Partially correct |
26 |
Partially correct |
55 ms |
9340 KB |
Partially correct |
27 |
Partially correct |
58 ms |
9340 KB |
Partially correct |
28 |
Partially correct |
62 ms |
9340 KB |
Partially correct |
29 |
Partially correct |
53 ms |
9340 KB |
Partially correct |
30 |
Partially correct |
16 ms |
9340 KB |
Partially correct |
31 |
Correct |
2 ms |
9340 KB |
Output is correct |
32 |
Correct |
2 ms |
9340 KB |
Output is correct |