Submission #23001

# Submission time Handle Problem Language Result Execution time Memory
23001 2017-05-01T06:05:52 Z kdh9949 Gap (APIO16_gap) C++14
30 / 100
109 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);
			if(w == b) w--;
			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:32: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]);
                   ^
# Verdict Execution time Memory 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 13 ms 4772 KB Output is correct
17 Correct 9 ms 4772 KB Output is correct
18 Correct 6 ms 4772 KB Output is correct
19 Correct 13 ms 4772 KB Output is correct
20 Correct 13 ms 4772 KB Output is correct
21 Correct 56 ms 5924 KB Output is correct
22 Correct 59 ms 5924 KB Output is correct
23 Correct 53 ms 5924 KB Output is correct
24 Correct 49 ms 5924 KB Output is correct
25 Correct 53 ms 5924 KB Output is correct
26 Correct 56 ms 5924 KB Output is correct
27 Correct 56 ms 5924 KB Output is correct
28 Correct 56 ms 5924 KB Output is correct
29 Correct 53 ms 5924 KB Output is correct
30 Correct 49 ms 5924 KB Output is correct
31 Correct 0 ms 4300 KB Output is correct
32 Correct 0 ms 4300 KB Output is correct
# Verdict Execution time Memory 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 13 ms 4772 KB Output is correct
17 Correct 19 ms 4772 KB Output is correct
18 Correct 13 ms 4772 KB Output is correct
19 Correct 13 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 79 ms 5924 KB Output is correct
23 Correct 69 ms 5924 KB Output is correct
24 Correct 86 ms 5924 KB Output is correct
25 Correct 89 ms 7460 KB Output is correct
26 Correct 109 ms 5924 KB Output is correct
27 Correct 76 ms 5924 KB Output is correct
28 Correct 63 ms 5924 KB Output is correct
29 Correct 96 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