Submission #95666

# Submission time Handle Problem Language Result Execution time Memory
95666 2019-02-02T07:24:08 Z jeff Gap (APIO16_gap) C++14
0 / 100
38 ms 2296 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 *= 2;
        y *= 2;
        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 *= 10;
        z *= 10;
        t *= 10;
        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 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 3 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 3 ms 636 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 8 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 38 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 8 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 8 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 5 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 26 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 25 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 25 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 25 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 20 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 25 ms 2296 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 25 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 25 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 26 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 14 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 2 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 3 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 8 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 9 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 9 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 9 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 5 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 25 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 25 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 26 ms 2296 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 25 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 19 ms 2044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 25 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 25 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 26 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 25 ms 2152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 14 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 2 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)