# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
95668 |
2019-02-02T07:25:14 Z |
jeff |
Gap (APIO16_gap) |
C++14 |
|
236 ms |
1276 KB |
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
inline unsigned long long mde(unsigned long long a, unsigned long long b, unsigned long long c) {
unsigned long long t = 0, y = 0, z = 0, i;
stack<unsigned long long> st;
while (b) st.push(b % 2), b /= 2;
while (!st.empty()) {
z <<= 1;
y <<= 1;
z += a * st.top();
st.pop();
y += z / (1LL << 62);
z %= (1LL << 62);
}
t += y / c;
y %= c;
for (i = 0; i < 62; ++i) {
y <<= 1;
z <<= 1;
t <<= 1;
y += z / (1LL << 62);
z %= (1LL << 62);
t += y / c;
y %= c;
}
return t;
}
long long findGap(int T, int N) {
long long l, r, y, z, ls = -1, rs = 0, a, b = 0, i;
MinMax(0, 1000000000000000000, &y, &z);
assert((long long) mde(z - y, N - 1, N - 1) == z - y);
for (i = 0; i < N - 1; ++i) {
a = y + mde(z - y, i, N - 1);
b = y + mde(z - y, i + 1, N - 1) - 1;
if (a >= b) continue;
MinMax(a, b, &l, &r);
if (l < 0 && r < 0) continue;
if (ls > -1) rs = max(rs, l - ls);
ls = r;
}
return max(rs, z - ls);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
10 |
Incorrect |
9 ms |
376 KB |
Output isn't correct |
11 |
Incorrect |
5 ms |
380 KB |
Output isn't correct |
12 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
13 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
14 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
15 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
16 |
Incorrect |
59 ms |
504 KB |
Output isn't correct |
17 |
Incorrect |
58 ms |
504 KB |
Output isn't correct |
18 |
Incorrect |
58 ms |
504 KB |
Output isn't correct |
19 |
Incorrect |
58 ms |
632 KB |
Output isn't correct |
20 |
Incorrect |
50 ms |
504 KB |
Output isn't correct |
21 |
Incorrect |
234 ms |
1212 KB |
Output isn't correct |
22 |
Incorrect |
229 ms |
1272 KB |
Output isn't correct |
23 |
Incorrect |
234 ms |
1272 KB |
Output isn't correct |
24 |
Incorrect |
236 ms |
1172 KB |
Output isn't correct |
25 |
Incorrect |
221 ms |
1144 KB |
Output isn't correct |
26 |
Incorrect |
227 ms |
1144 KB |
Output isn't correct |
27 |
Incorrect |
230 ms |
1156 KB |
Output isn't correct |
28 |
Incorrect |
230 ms |
1224 KB |
Output isn't correct |
29 |
Incorrect |
229 ms |
1144 KB |
Output isn't correct |
30 |
Incorrect |
198 ms |
1276 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 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 |
256 KB |
Output is correct |
8 |
Correct |
2 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 |
6 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
6 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
6 ms |
376 KB |
Output is correct |
16 |
Correct |
58 ms |
504 KB |
Output is correct |
17 |
Correct |
58 ms |
504 KB |
Output is correct |
18 |
Correct |
57 ms |
504 KB |
Output is correct |
19 |
Correct |
57 ms |
504 KB |
Output is correct |
20 |
Correct |
49 ms |
504 KB |
Output is correct |
21 |
Correct |
226 ms |
1276 KB |
Output is correct |
22 |
Correct |
227 ms |
1244 KB |
Output is correct |
23 |
Correct |
232 ms |
1144 KB |
Output is correct |
24 |
Correct |
227 ms |
1144 KB |
Output is correct |
25 |
Correct |
218 ms |
1256 KB |
Output is correct |
26 |
Correct |
236 ms |
1144 KB |
Output is correct |
27 |
Correct |
231 ms |
1272 KB |
Output is correct |
28 |
Correct |
236 ms |
1144 KB |
Output is correct |
29 |
Correct |
234 ms |
1192 KB |
Output is correct |
30 |
Correct |
198 ms |
1272 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
3 ms |
376 KB |
Output is correct |