Submission #1092474

# Submission time Handle Problem Language Result Execution time Memory
1092474 2024-09-24T07:33:16 Z alexander707070 Gap (APIO16_gap) C++14
17.9427 / 100
99 ms 10940 KB
#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});

    while(true){
        interval s=check(q.top().from,q.top().to);

        if(s.from==-1 and s.to==-1)return q.top().to-q.top().from;

        interval z=q.top();
        q.pop();

		if(s.from==-1)s.from=s.to;
		if(s.to==-1)s.to=s.from;

        if(z.from!=s.from)q.push({z.from,s.from});
        if(s.from!=s.to)q.push(s);
        if(s.to!=z.to)q.push({s.to,z.to});
    }

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Incorrect 0 ms 344 KB Output isn't correct
5 Incorrect 0 ms 344 KB Output isn't correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Incorrect 2 ms 596 KB Output isn't correct
16 Correct 8 ms 1112 KB Output is correct
17 Correct 6 ms 856 KB Output is correct
18 Correct 8 ms 856 KB Output is correct
19 Correct 6 ms 972 KB Output is correct
20 Correct 2 ms 600 KB Output is correct
21 Correct 28 ms 2772 KB Output is correct
22 Correct 25 ms 2448 KB Output is correct
23 Correct 32 ms 2508 KB Output is correct
24 Correct 26 ms 2516 KB Output is correct
25 Incorrect 96 ms 10940 KB Output isn't correct
26 Correct 30 ms 2764 KB Output is correct
27 Correct 33 ms 2284 KB Output is correct
28 Correct 29 ms 2364 KB Output is correct
29 Correct 25 ms 2516 KB Output is correct
30 Correct 7 ms 1112 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Partially correct 0 ms 344 KB Partially correct
3 Partially correct 0 ms 344 KB Partially correct
4 Correct 0 ms 344 KB Output is correct
5 Partially correct 0 ms 344 KB Partially correct
6 Partially correct 0 ms 344 KB Partially correct
7 Partially correct 0 ms 344 KB Partially correct
8 Partially correct 0 ms 344 KB Partially correct
9 Partially correct 0 ms 408 KB Partially correct
10 Partially correct 0 ms 344 KB Partially correct
11 Partially correct 1 ms 344 KB Partially correct
12 Partially correct 1 ms 340 KB Partially correct
13 Partially correct 1 ms 344 KB Partially correct
14 Partially correct 1 ms 344 KB Partially correct
15 Partially correct 1 ms 600 KB Partially correct
16 Partially correct 7 ms 1116 KB Partially correct
17 Partially correct 7 ms 1020 KB Partially correct
18 Partially correct 6 ms 856 KB Partially correct
19 Partially correct 6 ms 856 KB Partially correct
20 Partially correct 2 ms 600 KB Partially correct
21 Partially correct 29 ms 2300 KB Partially correct
22 Partially correct 25 ms 2772 KB Partially correct
23 Partially correct 26 ms 2508 KB Partially correct
24 Partially correct 25 ms 2260 KB Partially correct
25 Partially correct 99 ms 10940 KB Partially correct
26 Partially correct 26 ms 2516 KB Partially correct
27 Partially correct 26 ms 2708 KB Partially correct
28 Partially correct 29 ms 2764 KB Partially correct
29 Partially correct 25 ms 2296 KB Partially correct
30 Partially correct 7 ms 1112 KB Partially correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct