답안 #153902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153902 2019-09-17T11:27:57 Z songc Gap (APIO16_gap) C++14
30 / 100
79 ms 4584 KB
#include <bits/stdc++.h>
#include "gap.h"
#define INF 1'000'000'000'000'000'000ll
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

LL ans, C;
LL Min, Max;
vector<LL> V;

long long findGap(int T, int N){
	if (T == 1){
		LL l=0, r=INF;
		for (int i=0; i<N; i+=2){
			LL x, y;
			MinMax(l, r, &x, &y);
			V.push_back(x);
			V.push_back(y);
			l=x+1, r=y-1;
		}
	}
	else{
		MinMax(0, INF, &Min, &Max);
		ans = C = (Max-Min+N-2)/(N-1);
		LL t = Min;
		V.push_back(Min);
		while (t+C <= Max){
			LL x, y;
			MinMax(t+1, t+C, &x, &y);
			if (x>=0) V.push_back(x);
			if (y>=0) V.push_back(y);
			t += C;
		}
		V.push_back(Max);
	}
	sort(V.begin(), V.end());
	for (int i=0; i<V.size()-1; i++) ans = max(ans, V[i+1]-V[i]);
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:38:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0; i<V.size()-1; i++) ans = max(ans, V[i+1]-V[i]);
                ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 17 ms 1400 KB Output is correct
17 Correct 17 ms 1400 KB Output is correct
18 Correct 17 ms 1400 KB Output is correct
19 Correct 17 ms 1332 KB Output is correct
20 Correct 13 ms 1020 KB Output is correct
21 Correct 62 ms 4204 KB Output is correct
22 Correct 62 ms 4080 KB Output is correct
23 Correct 62 ms 4080 KB Output is correct
24 Correct 62 ms 4080 KB Output is correct
25 Correct 54 ms 3528 KB Output is correct
26 Correct 70 ms 3948 KB Output is correct
27 Correct 62 ms 4204 KB Output is correct
28 Correct 62 ms 4080 KB Output is correct
29 Correct 61 ms 4084 KB Output is correct
30 Correct 47 ms 2928 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 21 ms 1364 KB Output is correct
17 Correct 21 ms 1400 KB Output is correct
18 Correct 22 ms 1400 KB Output is correct
19 Correct 20 ms 1400 KB Output is correct
20 Correct 10 ms 760 KB Output is correct
21 Correct 78 ms 4180 KB Output is correct
22 Correct 78 ms 4208 KB Output is correct
23 Correct 77 ms 4100 KB Output is correct
24 Correct 78 ms 4080 KB Output is correct
25 Correct 76 ms 4584 KB Output is correct
26 Correct 78 ms 4152 KB Output is correct
27 Correct 77 ms 4180 KB Output is correct
28 Correct 78 ms 4080 KB Output is correct
29 Correct 79 ms 4144 KB Output is correct
30 Correct 40 ms 2168 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 348 KB Output is correct