Submission #107817

# Submission time Handle Problem Language Result Execution time Memory
107817 2019-04-25T22:03:23 Z Noam527 Gap (APIO16_gap) C++17
59.0375 / 100
102 ms 4360 KB
#include <bits/stdc++.h>
#define CHECK cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7;
const ll inf = 1e18;
const int OO = 1;
const int OOO = 1;
using namespace std;

void MinMax(ll s, ll t, ll *mn, ll *mx);

ll findGap(int t, int n) {
	ll lo, hi, a, b;
	vector<ll> pos;
	MinMax(0, inf, &lo, &hi);
	ll d = (hi - lo) / (n - 1);
	pos.push_back(lo);
	for (ll i = lo + 1; i < hi; i += d) {
		MinMax(i, i + d - 1, &a, &b);
		if (a != -1) {
			pos.push_back(a);
			pos.push_back(b);
		}
	}
	if (pos.back() != hi) pos.push_back(hi);
	ll rtn = pos[1] - pos[0];
	for (int i = 2; i < pos.size(); i++)
		rtn = max(rtn, pos[i] - pos[i - 1]);
	return rtn;
}
/*
int main() {
	ll ans = findGap(0, 4);
	cout << "my ans " << ans << '\n';
}
*/

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 2; i < pos.size(); i++)
                  ~~^~~~~~~~~~~~
# Verdict Execution time Memory 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 384 KB Output isn't correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 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 4 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 18 ms 1280 KB Output isn't correct
17 Incorrect 17 ms 1152 KB Output isn't correct
18 Incorrect 18 ms 1152 KB Output isn't correct
19 Incorrect 17 ms 1252 KB Output isn't correct
20 Incorrect 14 ms 512 KB Output isn't correct
21 Incorrect 69 ms 3952 KB Output isn't correct
22 Incorrect 94 ms 3952 KB Output isn't correct
23 Incorrect 82 ms 3948 KB Output isn't correct
24 Incorrect 78 ms 3952 KB Output isn't correct
25 Incorrect 71 ms 4360 KB Output isn't correct
26 Incorrect 72 ms 4080 KB Output isn't correct
27 Incorrect 65 ms 3952 KB Output isn't correct
28 Incorrect 90 ms 3960 KB Output isn't correct
29 Incorrect 95 ms 3952 KB Output isn't correct
30 Incorrect 38 ms 2040 KB Output isn't correct
31 Incorrect 2 ms 384 KB Output isn't correct
32 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory 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 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 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 3 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 17 ms 1152 KB Output is correct
17 Correct 19 ms 1152 KB Output is correct
18 Correct 20 ms 1164 KB Output is correct
19 Correct 18 ms 1280 KB Output is correct
20 Partially correct 10 ms 640 KB Partially correct
21 Correct 69 ms 3952 KB Output is correct
22 Correct 67 ms 3952 KB Output is correct
23 Correct 65 ms 3956 KB Output is correct
24 Correct 65 ms 3952 KB Output is correct
25 Correct 61 ms 4332 KB Output is correct
26 Correct 94 ms 3952 KB Output is correct
27 Correct 102 ms 4076 KB Output is correct
28 Correct 70 ms 3896 KB Output is correct
29 Correct 69 ms 3952 KB Output is correct
30 Partially correct 39 ms 2040 KB Partially correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct