답안 #23000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23000 2017-05-01T06:03:59 Z kdh9949 Gap (APIO16_gap) C++14
30 / 100
93 ms 7460 KB
#include "gap.h"
#include <algorithm>
using namespace std;
typedef long long ll;

vector<ll> v;
ll a = 0, b = (1LL << 62), c, x, y, ans;

ll findGap(int T, int N)
{
	if(T == 1){
        for(int i = 0; i < (N + 1) / 2; i++){
            MinMax(a + 1, b - 1, &a, &b);
            v.push_back(a); v.push_back(b);
        }
    }
	else{
		MinMax(a, b, &a, &b);
		v.push_back(a); v.push_back(b);
		c = b - a; N--;
		for(int i = 0; i < N; i++){
			ll q = a + c / N * i + 1;
			ll w = a + c / N * (i + 1) - (i == N - 1);
			if(q > w) continue;
			MinMax(q, w, &x, &y);
			if(x == -1) continue;
			v.push_back(x); v.push_back(y);
		}
	}
	sort(v.begin(), v.end());
	for(int i = 1; i < v.size(); i++) ans = max(ans, v[i] - v[i - 1]);
	return ans;
}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:31:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < v.size(); i++) ans = max(ans, v[i] - v[i - 1]);
                   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4300 KB Output is correct
2 Correct 0 ms 4300 KB Output is correct
3 Correct 0 ms 4300 KB Output is correct
4 Correct 0 ms 4300 KB Output is correct
5 Correct 0 ms 4300 KB Output is correct
6 Correct 0 ms 4300 KB Output is correct
7 Correct 0 ms 4300 KB Output is correct
8 Correct 0 ms 4300 KB Output is correct
9 Correct 0 ms 4300 KB Output is correct
10 Correct 0 ms 4300 KB Output is correct
11 Correct 0 ms 4300 KB Output is correct
12 Correct 0 ms 4300 KB Output is correct
13 Correct 0 ms 4300 KB Output is correct
14 Correct 0 ms 4300 KB Output is correct
15 Correct 0 ms 4300 KB Output is correct
16 Correct 9 ms 4772 KB Output is correct
17 Correct 13 ms 4772 KB Output is correct
18 Correct 19 ms 4772 KB Output is correct
19 Correct 13 ms 4772 KB Output is correct
20 Correct 9 ms 4772 KB Output is correct
21 Correct 56 ms 5924 KB Output is correct
22 Correct 56 ms 5924 KB Output is correct
23 Correct 56 ms 5924 KB Output is correct
24 Correct 73 ms 5924 KB Output is correct
25 Correct 53 ms 5924 KB Output is correct
26 Correct 59 ms 5924 KB Output is correct
27 Correct 53 ms 5924 KB Output is correct
28 Correct 53 ms 5924 KB Output is correct
29 Correct 59 ms 5924 KB Output is correct
30 Correct 43 ms 5924 KB Output is correct
31 Correct 0 ms 4300 KB Output is correct
32 Correct 0 ms 4300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4300 KB Output is correct
2 Correct 0 ms 4300 KB Output is correct
3 Correct 0 ms 4300 KB Output is correct
4 Correct 0 ms 4300 KB Output is correct
5 Correct 0 ms 4300 KB Output is correct
6 Correct 0 ms 4300 KB Output is correct
7 Correct 0 ms 4300 KB Output is correct
8 Correct 0 ms 4300 KB Output is correct
9 Correct 0 ms 4300 KB Output is correct
10 Correct 0 ms 4300 KB Output is correct
11 Correct 0 ms 4300 KB Output is correct
12 Correct 0 ms 4300 KB Output is correct
13 Correct 0 ms 4300 KB Output is correct
14 Correct 0 ms 4300 KB Output is correct
15 Correct 0 ms 4444 KB Output is correct
16 Correct 19 ms 4772 KB Output is correct
17 Correct 19 ms 4772 KB Output is correct
18 Correct 19 ms 4772 KB Output is correct
19 Correct 16 ms 4772 KB Output is correct
20 Incorrect 6 ms 4300 KB Output isn't correct
21 Correct 79 ms 5924 KB Output is correct
22 Correct 76 ms 5924 KB Output is correct
23 Correct 83 ms 5924 KB Output is correct
24 Correct 79 ms 5924 KB Output is correct
25 Correct 73 ms 7460 KB Output is correct
26 Correct 86 ms 5924 KB Output is correct
27 Correct 76 ms 5924 KB Output is correct
28 Correct 66 ms 5924 KB Output is correct
29 Correct 93 ms 5924 KB Output is correct
30 Incorrect 36 ms 4576 KB Output isn't correct
31 Correct 0 ms 4300 KB Output is correct
32 Correct 0 ms 4300 KB Output is correct