Submission #40766

# Submission time Handle Problem Language Result Execution time Memory
40766 2018-02-08T05:51:36 Z ssnsarang2023 Gap (APIO16_gap) C++14
0 / 100
103 ms 1520 KB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

typedef long long ll;

ll findGap(int _t, int _n) {
	ll n = _n;
	ll mn = 1, mx = (ll)1e18;
	MinMax(mn, mx, &mn, &mx);
	ll d = (mx - mn) / n, mod = (mx - mn) % n, pre = mn;
	ll pstep = mn, step = mn + d + - 1 + mod, gap = 0;
	while (1) {
		ll mntmp = -1, mxtmp = -1;
		if (pstep <= min(mx - 1, step)) MinMax(pstep + 1, min(mx - 1, step), &mntmp, &mxtmp);
		if (step >= mx) {
			if (mxtmp != -1) gap = max(gap, mx - mxtmp);
			else gap = max(gap, mx - pre);
		} else if (mntmp != -1) gap = max(gap, mntmp - pre);
		pre = mxtmp, pstep = step, step += d;
	}
	return gap;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution failed because the return code was nonzero
2 Runtime error 1 ms 376 KB Execution failed because the return code was nonzero
3 Runtime error 1 ms 424 KB Execution failed because the return code was nonzero
4 Runtime error 2 ms 496 KB Execution failed because the return code was nonzero
5 Runtime error 2 ms 548 KB Execution failed because the return code was nonzero
6 Runtime error 2 ms 620 KB Execution failed because the return code was nonzero
7 Runtime error 1 ms 620 KB Execution failed because the return code was nonzero
8 Runtime error 1 ms 624 KB Execution failed because the return code was nonzero
9 Runtime error 1 ms 624 KB Execution failed because the return code was nonzero
10 Runtime error 2 ms 624 KB Execution failed because the return code was nonzero
11 Runtime error 3 ms 624 KB Execution failed because the return code was nonzero
12 Runtime error 2 ms 624 KB Execution failed because the return code was nonzero
13 Runtime error 2 ms 624 KB Execution failed because the return code was nonzero
14 Runtime error 2 ms 624 KB Execution failed because the return code was nonzero
15 Runtime error 2 ms 624 KB Execution failed because the return code was nonzero
16 Runtime error 18 ms 748 KB Execution failed because the return code was nonzero
17 Runtime error 19 ms 748 KB Execution failed because the return code was nonzero
18 Runtime error 19 ms 748 KB Execution failed because the return code was nonzero
19 Runtime error 18 ms 748 KB Execution failed because the return code was nonzero
20 Runtime error 15 ms 748 KB Execution failed because the return code was nonzero
21 Runtime error 103 ms 1388 KB Execution failed because the return code was nonzero
22 Runtime error 75 ms 1388 KB Execution failed because the return code was nonzero
23 Runtime error 72 ms 1388 KB Execution failed because the return code was nonzero
24 Runtime error 73 ms 1516 KB Execution failed because the return code was nonzero
25 Runtime error 69 ms 1516 KB Execution failed because the return code was nonzero
26 Runtime error 72 ms 1516 KB Execution failed because the return code was nonzero
27 Runtime error 75 ms 1516 KB Execution failed because the return code was nonzero
28 Runtime error 72 ms 1516 KB Execution failed because the return code was nonzero
29 Runtime error 75 ms 1516 KB Execution failed because the return code was nonzero
30 Runtime error 40 ms 1516 KB Execution failed because the return code was nonzero
31 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
2 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
3 Runtime error 2 ms 1516 KB Execution failed because the return code was nonzero
4 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
5 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
6 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
7 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
8 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
9 Runtime error 2 ms 1516 KB Execution failed because the return code was nonzero
10 Runtime error 1 ms 1516 KB Execution failed because the return code was nonzero
11 Runtime error 2 ms 1516 KB Execution failed because the return code was nonzero
12 Runtime error 2 ms 1516 KB Execution failed because the return code was nonzero
13 Runtime error 3 ms 1516 KB Execution failed because the return code was nonzero
14 Runtime error 4 ms 1516 KB Execution failed because the return code was nonzero
15 Runtime error 2 ms 1516 KB Execution failed because the return code was nonzero
16 Runtime error 18 ms 1516 KB Execution failed because the return code was nonzero
17 Runtime error 19 ms 1516 KB Execution failed because the return code was nonzero
18 Runtime error 19 ms 1516 KB Execution failed because the return code was nonzero
19 Runtime error 23 ms 1516 KB Execution failed because the return code was nonzero
20 Runtime error 10 ms 1516 KB Execution failed because the return code was nonzero
21 Runtime error 71 ms 1516 KB Execution failed because the return code was nonzero
22 Runtime error 73 ms 1516 KB Execution failed because the return code was nonzero
23 Runtime error 70 ms 1516 KB Execution failed because the return code was nonzero
24 Runtime error 74 ms 1516 KB Execution failed because the return code was nonzero
25 Runtime error 68 ms 1520 KB Execution failed because the return code was nonzero
26 Runtime error 73 ms 1520 KB Execution failed because the return code was nonzero
27 Runtime error 73 ms 1520 KB Execution failed because the return code was nonzero
28 Runtime error 72 ms 1520 KB Execution failed because the return code was nonzero
29 Runtime error 77 ms 1520 KB Execution failed because the return code was nonzero
30 Runtime error 40 ms 1520 KB Execution failed because the return code was nonzero
31 Runtime error 2 ms 1520 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 1520 KB Execution failed because the return code was nonzero