Submission #981630

# Submission time Handle Problem Language Result Execution time Memory
981630 2024-05-13T11:51:40 Z ShauryaTheShep Gap (APIO16_gap) C++14
0 / 100
2000 ms 3108 KB
#include <iostream>
#include <climits>
#include <vector>

// Function prototype for provided MinMax function
void MinMax(long long s, long long t, long long* mn, long long* mx);

long long findGap(int T, int N) {
    if (T != 1) {
        // Subtask 1 implementation only
        return -1;
    }

    long long globalMin, globalMax;
    MinMax(LONG_LONG_MIN, LONG_LONG_MAX, &globalMin, &globalMax);

    if (N == 1) {
        // If there is only one number, no gap exists
        return 0;
    }

    long long maxGap = 0;
    long long prevMax = globalMin;
    bool first = true;

    // Brute-force from globalMin to globalMax in larger steps
    for (long long i = globalMin; i <= globalMax; i++) {
        long long mn, mx;
        MinMax(i, i, &mn, &mx);

        if (mn != -1) { // Valid number found
            if (!first) {
                maxGap = std::max(maxGap, mn - prevMax);
            } else {
                first = false;
            }
            prevMax = mx; // Update previous max
        }
    }

    return maxGap;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3021 ms 344 KB Time limit exceeded
2 Execution timed out 3045 ms 2392 KB Time limit exceeded
3 Execution timed out 3009 ms 2392 KB Time limit exceeded
4 Execution timed out 3015 ms 2644 KB Time limit exceeded
5 Incorrect 599 ms 2392 KB Output isn't correct
6 Execution timed out 3068 ms 2388 KB Time limit exceeded
7 Execution timed out 3051 ms 2392 KB Time limit exceeded
8 Execution timed out 3011 ms 2392 KB Time limit exceeded
9 Execution timed out 3066 ms 2392 KB Time limit exceeded
10 Incorrect 48 ms 2468 KB Output isn't correct
11 Execution timed out 3079 ms 2392 KB Time limit exceeded
12 Execution timed out 3064 ms 2392 KB Time limit exceeded
13 Execution timed out 3040 ms 2392 KB Time limit exceeded
14 Execution timed out 3030 ms 2392 KB Time limit exceeded
15 Execution timed out 3070 ms 2388 KB Time limit exceeded
16 Execution timed out 3021 ms 2584 KB Time limit exceeded
17 Execution timed out 3071 ms 2588 KB Time limit exceeded
18 Execution timed out 3095 ms 2584 KB Time limit exceeded
19 Execution timed out 3016 ms 2584 KB Time limit exceeded
20 Incorrect 105 ms 2584 KB Output isn't correct
21 Execution timed out 3010 ms 2856 KB Time limit exceeded
22 Execution timed out 3034 ms 2864 KB Time limit exceeded
23 Execution timed out 3056 ms 2852 KB Time limit exceeded
24 Execution timed out 3003 ms 2852 KB Time limit exceeded
25 Execution timed out 3044 ms 2852 KB Time limit exceeded
26 Execution timed out 3087 ms 2852 KB Time limit exceeded
27 Execution timed out 3047 ms 2852 KB Time limit exceeded
28 Execution timed out 3040 ms 2856 KB Time limit exceeded
29 Execution timed out 3048 ms 2852 KB Time limit exceeded
30 Incorrect 145 ms 2848 KB Output isn't correct
31 Execution timed out 3091 ms 2392 KB Time limit exceeded
32 Execution timed out 3060 ms 2388 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2392 KB Output isn't correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2392 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 4 ms 2580 KB Output isn't correct
17 Incorrect 4 ms 2584 KB Output isn't correct
18 Incorrect 4 ms 2752 KB Output isn't correct
19 Incorrect 4 ms 2752 KB Output isn't correct
20 Incorrect 2 ms 2568 KB Output isn't correct
21 Incorrect 15 ms 2832 KB Output isn't correct
22 Incorrect 13 ms 2852 KB Output isn't correct
23 Incorrect 13 ms 2856 KB Output isn't correct
24 Incorrect 15 ms 2648 KB Output isn't correct
25 Incorrect 13 ms 2864 KB Output isn't correct
26 Incorrect 13 ms 2860 KB Output isn't correct
27 Incorrect 14 ms 2864 KB Output isn't correct
28 Incorrect 13 ms 2852 KB Output isn't correct
29 Incorrect 13 ms 3108 KB Output isn't correct
30 Incorrect 8 ms 2764 KB Output isn't correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct