답안 #1092471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1092471 2024-09-24T07:27:52 Z alexander707070 Gap (APIO16_gap) C++14
0 / 100
125 ms 21316 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 1/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 1/0;
      |      ~~~~~~~~^~
gap.cpp:51:25: warning: division by zero [-Wdiv-by-zero]
   51 |   if(q.size()>N)return 1/0;
      |                        ~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Runtime error 2 ms 4696 KB Execution killed with signal 4
3 Incorrect 0 ms 2392 KB Output isn't correct
4 Runtime error 2 ms 4696 KB Execution killed with signal 4
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Correct 0 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 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 2904 KB Output isn't correct
17 Correct 6 ms 2904 KB Output is correct
18 Incorrect 5 ms 2648 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 47 ms 5876 KB Output isn't correct
22 Runtime error 125 ms 21316 KB Execution killed with signal 4
23 Incorrect 24 ms 3788 KB Output isn't correct
24 Correct 26 ms 3944 KB Output is correct
25 Incorrect 102 ms 12476 KB Output isn't correct
26 Correct 37 ms 4360 KB Output is correct
27 Correct 29 ms 3912 KB Output is correct
28 Correct 28 ms 4052 KB Output is correct
29 Incorrect 33 ms 3788 KB Output isn't correct
30 Correct 8 ms 2648 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Incorrect 1 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 2388 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 2 ms 4696 KB Execution killed with signal 4
9 Incorrect 0 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 Runtime error 3 ms 5204 KB Execution killed with signal 4
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 7 ms 2904 KB Output isn't correct
17 Incorrect 6 ms 2904 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 2 ms 2392 KB Partially correct
21 Partially correct 26 ms 3920 KB Partially correct
22 Incorrect 19 ms 3540 KB Output isn't correct
23 Partially correct 26 ms 4040 KB Partially correct
24 Partially correct 34 ms 3932 KB Partially correct
25 Partially correct 93 ms 12476 KB Partially correct
26 Incorrect 24 ms 3796 KB Output isn't correct
27 Incorrect 26 ms 4052 KB Output isn't correct
28 Incorrect 27 ms 4300 KB Output isn't correct
29 Partially correct 26 ms 4052 KB Partially correct
30 Partially correct 13 ms 2648 KB Partially correct
31 Correct 1 ms 2392 KB Output is correct
32 Incorrect 1 ms 2392 KB Output isn't correct