Submission #567642

# Submission time Handle Problem Language Result Execution time Memory
567642 2022-05-23T22:16:00 Z four_specks Gap (APIO16_gap) C++17
70 / 100
57 ms 2092 KB
#include "gap.h"

#include <bits/stdc++.h>

using namespace std;

long long findGap(int T, int N)
{
    if (T == 1)
    {
        assert(0);
        vector<long long> a(N);
        long long mn = 0, mx = LLONG_MAX;
        for (int l = 0, r = N - 1; l < r; l++, r--)
        {
            MinMax(mn, mx, &mn, &mx);
            if (mn != -1)
            {
                a[l] = mn, a[r] = mx;
                mn += 1, mx -= 1;
            }
            else
                assert(0);
        }

        long long gap = 0;
        for (int i = 0; i < N - 1; i++)
            gap = max(gap, a[i + 1] - a[i]);

        return gap;
    }
    else if (T == 2)
    {
        long long l = 0, r = LLONG_MAX;
        MinMax(l, r, &l, &r);

        long long block = (r - l + 1) / (N - 1);

        long long gap = 0;

        long long x = l;
        for (l += 1; l <= r; l += block + 1)
        {
            long long mn, mx;
            MinMax(l, l + block, &mn, &mx);
            if (mn != -1)
            {
                gap = max(gap, mn - x);
                x = mx;
            }
        }

        return gap;
    }
    else
        assert(0);

    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Runtime error 1 ms 464 KB Execution killed with signal 6
3 Runtime error 1 ms 476 KB Execution killed with signal 6
4 Runtime error 1 ms 464 KB Execution killed with signal 6
5 Runtime error 1 ms 464 KB Execution killed with signal 6
6 Runtime error 1 ms 472 KB Execution killed with signal 6
7 Runtime error 1 ms 464 KB Execution killed with signal 6
8 Runtime error 1 ms 464 KB Execution killed with signal 6
9 Runtime error 1 ms 464 KB Execution killed with signal 6
10 Runtime error 1 ms 464 KB Execution killed with signal 6
11 Runtime error 1 ms 464 KB Execution killed with signal 6
12 Runtime error 1 ms 464 KB Execution killed with signal 6
13 Runtime error 1 ms 464 KB Execution killed with signal 6
14 Runtime error 1 ms 464 KB Execution killed with signal 6
15 Runtime error 1 ms 464 KB Execution killed with signal 6
16 Runtime error 5 ms 808 KB Execution killed with signal 6
17 Runtime error 5 ms 848 KB Execution killed with signal 6
18 Runtime error 5 ms 808 KB Execution killed with signal 6
19 Runtime error 5 ms 848 KB Execution killed with signal 6
20 Runtime error 3 ms 848 KB Execution killed with signal 6
21 Runtime error 18 ms 1992 KB Execution killed with signal 6
22 Runtime error 17 ms 1944 KB Execution killed with signal 6
23 Runtime error 19 ms 1952 KB Execution killed with signal 6
24 Runtime error 17 ms 1996 KB Execution killed with signal 6
25 Runtime error 14 ms 1992 KB Execution killed with signal 6
26 Runtime error 21 ms 2044 KB Execution killed with signal 6
27 Runtime error 24 ms 2000 KB Execution killed with signal 6
28 Runtime error 18 ms 1952 KB Execution killed with signal 6
29 Runtime error 17 ms 1964 KB Execution killed with signal 6
30 Runtime error 11 ms 2092 KB Execution killed with signal 6
31 Runtime error 1 ms 464 KB Execution killed with signal 6
32 Runtime error 1 ms 464 KB Execution killed with signal 6
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 12 ms 516 KB Output is correct
17 Correct 14 ms 464 KB Output is correct
18 Correct 12 ms 432 KB Output is correct
19 Correct 12 ms 512 KB Output is correct
20 Correct 6 ms 464 KB Output is correct
21 Correct 49 ms 1052 KB Output is correct
22 Correct 50 ms 1088 KB Output is correct
23 Correct 50 ms 1084 KB Output is correct
24 Correct 49 ms 1044 KB Output is correct
25 Correct 46 ms 1156 KB Output is correct
26 Correct 49 ms 1084 KB Output is correct
27 Correct 51 ms 1080 KB Output is correct
28 Correct 49 ms 1092 KB Output is correct
29 Correct 57 ms 1060 KB Output is correct
30 Correct 27 ms 1084 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct