답안 #102465

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102465 2019-03-25T06:58:13 Z Nicholas_Patrick Gap (APIO16_gap) C++17
30 / 100
116 ms 6008 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;
			if(m>M)
				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)-1;
			while(true){
				if(numbers.size()==n)
					break;
				if(m>M)
					break;
				MinMax(m, M, &m, &M);
				if(m==-1)
					break;
				numbers.insert(m);
				if(m==M)
					break;
				numbers.insert(M);
				m++;M--;
			}
		}
	}
	m=0;
	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:33:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(numbers.size()==n)
        ~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 28 ms 1628 KB Output is correct
17 Correct 24 ms 1656 KB Output is correct
18 Correct 22 ms 1636 KB Output is correct
19 Correct 22 ms 1664 KB Output is correct
20 Correct 17 ms 1664 KB Output is correct
21 Correct 95 ms 5880 KB Output is correct
22 Correct 89 ms 5724 KB Output is correct
23 Correct 105 ms 5772 KB Output is correct
24 Correct 104 ms 5880 KB Output is correct
25 Correct 72 ms 5752 KB Output is correct
26 Correct 88 ms 5880 KB Output is correct
27 Correct 83 ms 5772 KB Output is correct
28 Correct 109 ms 5832 KB Output is correct
29 Correct 100 ms 6008 KB Output is correct
30 Correct 79 ms 5772 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Partially correct 2 ms 384 KB Partially correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Partially correct 3 ms 256 KB Partially correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Partially correct 3 ms 384 KB Partially correct
16 Correct 27 ms 1616 KB Output is correct
17 Correct 22 ms 1664 KB Output is correct
18 Correct 21 ms 1664 KB Output is correct
19 Correct 28 ms 1792 KB Output is correct
20 Partially correct 23 ms 1656 KB Partially correct
21 Correct 116 ms 5856 KB Output is correct
22 Correct 102 ms 5888 KB Output is correct
23 Correct 97 ms 5880 KB Output is correct
24 Correct 98 ms 5756 KB Output is correct
25 Incorrect 84 ms 5852 KB Expected int32, but "2500100000" found
26 Correct 86 ms 5752 KB Output is correct
27 Correct 91 ms 5880 KB Output is correct
28 Correct 93 ms 5752 KB Output is correct
29 Correct 97 ms 5820 KB Output is correct
30 Incorrect 80 ms 5816 KB Expected int32, but "2500100000" found
31 Partially correct 2 ms 256 KB Partially correct
32 Partially correct 2 ms 384 KB Partially correct