Submission #872964

# Submission time Handle Problem Language Result Execution time Memory
872964 2023-11-14T07:45:21 Z StefanL2005 Gap (APIO16_gap) C++14
0 / 100
17 ms 3812 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
#define ll long long

ll findGap(int T, int N)
{
    vector<ll> v(N);

    int p1 = 0, p2 = N - 1;
    ll a = -1, b = 1000 * 1000 * 1000 * 1000 * 1000 * 1000+ 1;

    while (p1 <= p2)
    {
        ll c1, c2;
        MinMax(a + 1, b - 1, &c1, &c2);
        v[p1] = c1;
        v[p2] = c2;
        p1++; p2--;
        a = c1; b = c2;
    }


    ll maxDif = 0;
    for (int i = 1; i < N; i++)
        maxDif = max(maxDif, v[i] - v[i - 1]);

    return maxDif;
}


Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:11:39: warning: integer overflow in expression of type 'int' results in '-727379968' [-Woverflow]
   11 |     ll a = -1, b = 1000 * 1000 * 1000 * 1000 * 1000 * 1000+ 1;
      |                    ~~~~~~~~~~~~~~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 2644 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 2492 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
16 Runtime error 4 ms 2580 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 2740 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 2672 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 2584 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 2572 KB Execution failed because the return code was nonzero
21 Runtime error 16 ms 3592 KB Execution failed because the return code was nonzero
22 Runtime error 13 ms 3632 KB Execution failed because the return code was nonzero
23 Runtime error 13 ms 3620 KB Execution failed because the return code was nonzero
24 Runtime error 13 ms 3532 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 3616 KB Execution failed because the return code was nonzero
26 Runtime error 13 ms 3580 KB Execution failed because the return code was nonzero
27 Runtime error 13 ms 3620 KB Execution failed because the return code was nonzero
28 Runtime error 17 ms 3616 KB Execution failed because the return code was nonzero
29 Runtime error 13 ms 3624 KB Execution failed because the return code was nonzero
30 Runtime error 9 ms 3628 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
2 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
7 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 2484 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 2644 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
16 Runtime error 5 ms 2576 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 2584 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 2720 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 2580 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 2792 KB Execution failed because the return code was nonzero
21 Runtime error 14 ms 3600 KB Execution failed because the return code was nonzero
22 Runtime error 13 ms 3628 KB Execution failed because the return code was nonzero
23 Runtime error 13 ms 3812 KB Execution failed because the return code was nonzero
24 Runtime error 13 ms 3624 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 3592 KB Execution failed because the return code was nonzero
26 Runtime error 13 ms 3620 KB Execution failed because the return code was nonzero
27 Runtime error 13 ms 3628 KB Execution failed because the return code was nonzero
28 Runtime error 13 ms 3788 KB Execution failed because the return code was nonzero
29 Runtime error 15 ms 3624 KB Execution failed because the return code was nonzero
30 Runtime error 8 ms 3624 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero