# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
981634 |
2024-05-13T11:56:46 Z |
ShauryaTheShep |
Gap (APIO16_gap) |
C++14 |
|
40 ms |
3100 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) {
// Only implementing subtask 1
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;
}
// Calculate optimal number of segments
long long segmentSize = (globalMax - globalMin) / (N - 1);
long long maxGap = 0;
long long lastMax = globalMin;
// Process each segment to find the largest gap
for (long long i = 0; i < N - 1; ++i) {
long long s = globalMin + i * segmentSize + 1; // Start of the next segment
long long t = s + segmentSize - 1; // End of the next segment
if (i == N - 2) t = globalMax; // Ensure the last segment reaches globalMax
long long mn, mx;
MinMax(s, t, &mn, &mx);
if (mn != -1) { // If there are numbers in this range
maxGap = std::max(maxGap, mn - lastMax);
lastMax = mx;
}
}
return maxGap;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
3 |
Incorrect |
0 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 |
11 ms |
2580 KB |
Output isn't correct |
17 |
Incorrect |
12 ms |
2580 KB |
Output isn't correct |
18 |
Incorrect |
10 ms |
2388 KB |
Output isn't correct |
19 |
Incorrect |
10 ms |
2584 KB |
Output isn't correct |
20 |
Incorrect |
5 ms |
2576 KB |
Output isn't correct |
21 |
Incorrect |
39 ms |
2856 KB |
Output isn't correct |
22 |
Incorrect |
38 ms |
2856 KB |
Output isn't correct |
23 |
Incorrect |
39 ms |
2856 KB |
Output isn't correct |
24 |
Incorrect |
40 ms |
2852 KB |
Output isn't correct |
25 |
Incorrect |
37 ms |
3100 KB |
Output isn't correct |
26 |
Incorrect |
39 ms |
2852 KB |
Output isn't correct |
27 |
Incorrect |
39 ms |
2860 KB |
Output isn't correct |
28 |
Incorrect |
40 ms |
2860 KB |
Output isn't correct |
29 |
Incorrect |
38 ms |
2856 KB |
Output isn't correct |
30 |
Incorrect |
21 ms |
2616 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 |
# |
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 |
0 ms |
2392 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
2456 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 |
2592 KB |
Output isn't correct |
17 |
Incorrect |
4 ms |
2584 KB |
Output isn't correct |
18 |
Incorrect |
5 ms |
2584 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
2584 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
2572 KB |
Output isn't correct |
21 |
Incorrect |
12 ms |
2856 KB |
Output isn't correct |
22 |
Incorrect |
12 ms |
2848 KB |
Output isn't correct |
23 |
Incorrect |
12 ms |
2856 KB |
Output isn't correct |
24 |
Incorrect |
12 ms |
2852 KB |
Output isn't correct |
25 |
Incorrect |
10 ms |
2856 KB |
Output isn't correct |
26 |
Incorrect |
12 ms |
3020 KB |
Output isn't correct |
27 |
Incorrect |
13 ms |
2812 KB |
Output isn't correct |
28 |
Incorrect |
12 ms |
2856 KB |
Output isn't correct |
29 |
Incorrect |
12 ms |
2856 KB |
Output isn't correct |
30 |
Incorrect |
8 ms |
2848 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |