답안 #102459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102459 2019-03-25T06:34:54 Z Nicholas_Patrick Gap (APIO16_gap) C++17
0 / 100
119 ms 5892 KB
#include "gap.h"
#include <set>
using namespace std;

long long findGap(int t, int n){
	set <long long> numbers;
	long long m, M;
	if(t==1){
		m=0;
		M=1000000000000000000;
		while(true){
			if(numbers.size()==n)
				break;
			MinMax(m, M, &m, &M);
			if(m==-1)
				break;
			numbers.insert(m);
			if(m==M)
				break;
			numbers.insert(M);
			m++;M--;
		}
	}else if(t==2){
		for(int i = 0;i < n>>1;i ++){
			m=(long double)i*1e18/(n>>1);
			if(i==(n>>1)-1)
				M=1000000000000000000;
			else
				M=(long double)(i+1)*1e18/(n>>1);
			while(true){
				if(numbers.size()==n)
					break;
				MinMax(m, M, &m, &M);
				if(m==-1)
					break;
				numbers.insert(m);
				if(m==M)
					break;
				numbers.insert(M);
				m++;M--;
			}
		}
	}
	m=1000000000000000000;
	set <long long>::iterator it=numbers.begin();
	M=*it;
	while(++it!=numbers.end()){
		m=max(m, *it-M);
		M=*it;
	}
	return m;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:12:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(numbers.size()==n)
       ~~~~~~~~~~~~~~^~~
gap.cpp:31:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(numbers.size()==n)
        ~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Incorrect 3 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct
11 Incorrect 3 ms 384 KB Output isn't correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Incorrect 3 ms 384 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Incorrect 20 ms 1664 KB Output isn't correct
17 Incorrect 19 ms 1664 KB Output isn't correct
18 Incorrect 21 ms 1740 KB Output isn't correct
19 Incorrect 21 ms 1656 KB Output isn't correct
20 Incorrect 16 ms 1664 KB Output isn't correct
21 Incorrect 87 ms 5800 KB Output isn't correct
22 Incorrect 94 ms 5732 KB Output isn't correct
23 Incorrect 89 ms 5880 KB Output isn't correct
24 Incorrect 80 ms 5832 KB Output isn't correct
25 Incorrect 85 ms 5752 KB Output isn't correct
26 Incorrect 78 ms 5852 KB Output isn't correct
27 Incorrect 80 ms 5752 KB Output isn't correct
28 Incorrect 81 ms 5852 KB Output isn't correct
29 Incorrect 76 ms 5752 KB Output isn't correct
30 Incorrect 66 ms 5752 KB Output isn't correct
31 Incorrect 2 ms 256 KB Output isn't correct
32 Incorrect 2 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 2 ms 304 KB Output isn't correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Incorrect 3 ms 384 KB Output isn't correct
7 Incorrect 3 ms 256 KB Output isn't correct
8 Incorrect 3 ms 384 KB Output isn't correct
9 Incorrect 2 ms 256 KB Output isn't correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 Incorrect 4 ms 384 KB Output isn't correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Incorrect 4 ms 512 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Incorrect 23 ms 1700 KB Output isn't correct
17 Incorrect 23 ms 1664 KB Output isn't correct
18 Incorrect 25 ms 1792 KB Output isn't correct
19 Incorrect 23 ms 1664 KB Output isn't correct
20 Incorrect 17 ms 1680 KB Output isn't correct
21 Incorrect 89 ms 5880 KB Output isn't correct
22 Incorrect 103 ms 5752 KB Output isn't correct
23 Incorrect 101 ms 5724 KB Output isn't correct
24 Incorrect 119 ms 5752 KB Output isn't correct
25 Incorrect 86 ms 5804 KB Expected int32, but "2500100000" found
26 Incorrect 91 ms 5752 KB Output isn't correct
27 Incorrect 91 ms 5880 KB Output isn't correct
28 Incorrect 89 ms 5892 KB Output isn't correct
29 Incorrect 105 ms 5800 KB Output isn't correct
30 Incorrect 72 ms 5756 KB Expected int32, but "2500100000" found
31 Runtime error 2 ms 384 KB Execution failed because the return code was nonzero
32 Incorrect 2 ms 256 KB Output isn't correct