Submission #1092469

# Submission time Handle Problem Language Result Execution time Memory
1092469 2024-09-24T07:27:23 Z alexander707070 Gap (APIO16_gap) C++14
0 / 100
113 ms 12480 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){
		if(q.size()>N)return 0;
		
        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;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:51:14: warning: comparison of integer expressions of different signedness: 'std::priority_queue<interval>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   51 |   if(q.size()>N)return 0;
      |      ~~~~~~~~^~
# Verdict Execution time Memory 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 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Correct 0 ms 2392 KB Output is correct
7 Correct 0 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 9 ms 2776 KB Output isn't correct
17 Correct 6 ms 2904 KB Output is correct
18 Incorrect 7 ms 2648 KB Output isn't correct
19 Correct 7 ms 2924 KB Output is correct
20 Correct 4 ms 2392 KB Output is correct
21 Incorrect 42 ms 5832 KB Output isn't correct
22 Incorrect 101 ms 10484 KB Output isn't correct
23 Incorrect 24 ms 3764 KB Output isn't correct
24 Correct 37 ms 2508 KB Output is correct
25 Incorrect 113 ms 10976 KB Output isn't correct
26 Correct 26 ms 2772 KB Output is correct
27 Correct 37 ms 2508 KB Output is correct
28 Correct 27 ms 2508 KB Output is correct
29 Incorrect 25 ms 2260 KB Output isn't correct
30 Correct 13 ms 1112 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Incorrect 1 ms 412 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Partially correct 1 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 1 ms 2392 KB Partially correct
7 Partially correct 1 ms 2392 KB Partially correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Partially correct 0 ms 2392 KB Partially correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 2 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 Partially correct 1 ms 2648 KB Partially correct
16 Incorrect 11 ms 2904 KB Output isn't correct
17 Incorrect 9 ms 2756 KB Output isn't correct
18 Partially correct 7 ms 2904 KB Partially correct
19 Partially correct 8 ms 2904 KB Partially correct
20 Partially correct 2 ms 2392 KB Partially correct
21 Partially correct 27 ms 4052 KB Partially correct
22 Incorrect 20 ms 3556 KB Output isn't correct
23 Partially correct 26 ms 4052 KB Partially correct
24 Partially correct 27 ms 4044 KB Partially correct
25 Partially correct 101 ms 12480 KB Partially correct
26 Incorrect 24 ms 3824 KB Output isn't correct
27 Incorrect 33 ms 4052 KB Output isn't correct
28 Incorrect 30 ms 4176 KB Output isn't correct
29 Partially correct 34 ms 4128 KB Partially correct
30 Partially correct 7 ms 2648 KB Partially correct
31 Correct 1 ms 2392 KB Output is correct
32 Incorrect 0 ms 2392 KB Output isn't correct