답안 #981625

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
981625 2024-05-13T11:49:03 Z ShauryaTheShep Gap (APIO16_gap) C++14
0 / 100
42 ms 3108 KB
#include <iostream>
#include <climits> // For LONG_LONG_MIN and LONG_LONG_MAX

// 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;
    long long mn, mx;
    MinMax(LONG_LONG_MIN, LONG_LONG_MAX, &globalMin, &globalMax);

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

    // Calculate the expected maximum number of gaps (N-1)
    long long maxGap = 0;
    long long interval = (globalMax - globalMin) / (N - 1);
    long long prevMax = globalMin;

    for (int i = 1; i < N; ++i) {
        long long lower = globalMin + i * interval;
        long long upper = lower + interval;
        
        MinMax(lower, upper, &mn, &mx);

        if (mn != -1) { // Check if there are numbers in this range
            maxGap = std::max(maxGap, mn - prevMax);
            prevMax = mx;
        }
    }

    // Also check the final gap
    maxGap = std::max(maxGap, globalMax - prevMax);

    return maxGap;
}

// Assume MinMax is implemented correctly as per the problem's environment.
// Typically, this would be something provided in a competitive programming environment.
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 0 ms 2392 KB Output isn't correct
4 Incorrect 0 ms 2392 KB Output isn't correct
5 Incorrect 0 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 0 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 2 ms 2392 KB Output isn't correct
16 Incorrect 11 ms 2752 KB Output isn't correct
17 Incorrect 10 ms 2592 KB Output isn't correct
18 Incorrect 10 ms 2596 KB Output isn't correct
19 Incorrect 10 ms 2588 KB Output isn't correct
20 Incorrect 5 ms 2568 KB Output isn't correct
21 Incorrect 38 ms 2844 KB Output isn't correct
22 Incorrect 38 ms 2856 KB Output isn't correct
23 Incorrect 38 ms 3016 KB Output isn't correct
24 Incorrect 39 ms 2856 KB Output isn't correct
25 Incorrect 42 ms 2840 KB Output isn't correct
26 Incorrect 38 ms 2856 KB Output isn't correct
27 Incorrect 39 ms 2852 KB Output isn't correct
28 Incorrect 39 ms 2856 KB Output isn't correct
29 Incorrect 38 ms 2852 KB Output isn't correct
30 Incorrect 20 ms 2852 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Incorrect 0 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 0 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 0 ms 2392 KB Output isn't correct
8 Incorrect 0 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 2388 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 3 ms 2580 KB Output isn't correct
17 Incorrect 3 ms 2752 KB Output isn't correct
18 Incorrect 4 ms 2588 KB Output isn't correct
19 Incorrect 3 ms 2580 KB Output isn't correct
20 Incorrect 2 ms 2572 KB Output isn't correct
21 Incorrect 12 ms 2800 KB Output isn't correct
22 Incorrect 12 ms 2852 KB Output isn't correct
23 Incorrect 12 ms 2856 KB Output isn't correct
24 Incorrect 12 ms 2836 KB Output isn't correct
25 Incorrect 9 ms 3108 KB Output isn't correct
26 Incorrect 12 ms 2852 KB Output isn't correct
27 Incorrect 12 ms 3016 KB Output isn't correct
28 Incorrect 12 ms 3020 KB Output isn't correct
29 Incorrect 12 ms 2852 KB Output isn't correct
30 Incorrect 8 ms 2856 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