Submission #1083372

# Submission time Handle Problem Language Result Execution time Memory
1083372 2024-09-03T03:37:39 Z dong_gas Gap (APIO16_gap) C++17
36.4577 / 100
66 ms 4348 KB
#include <bits/stdc++.h>

#include "gap.h"

using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll a[100201];
ll l[100201], r[100201];
pll b[100201];
const ll inf = 1'000'000'000'000'000'000;

ll findGap(int T, int n) {
    ll mn, mx, ret = 0;
    MinMax(0, inf, &mn, &mx);
    a[1] = mn, a[n] = mx;
    ll gap = (mx - mn + 1) / n;
    for (ll i = a[1], cnt = 1; cnt <= n; i += gap, cnt++) {
        l[cnt] = i, r[cnt] = i + gap - 1;
        if (cnt == n) r[cnt] = a[n];
    }
    bool full = true;
    for (int i = 1; i <= n; i++) {
        MinMax(l[i], r[i], &mn, &mx);
        b[i] = {mn, mx};
        if (mn == -1) full = false;
    }
    if (full) {
        for (int i = 2; i <= n; i++) {
            ret = max(ret, b[i].first - b[i - 1].first);
        }
    } else {
        ll bef = -1;
        for (int i = 1; i <= n; i++) {
            if (b[i].first == -1) continue;
            if(bef!=-1) {
                MinMax(bef, b[i].first, &mn, &mx);
                ret = max(ret, mx - mn);
            }            
            bef = b[i].second;
        }

    }
    return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Incorrect 0 ms 344 KB Output isn't correct
5 Incorrect 0 ms 344 KB Output isn't correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Incorrect 0 ms 344 KB Output isn't correct
10 Incorrect 0 ms 344 KB Output isn't correct
11 Incorrect 1 ms 344 KB Output isn't correct
12 Incorrect 1 ms 344 KB Output isn't correct
13 Incorrect 1 ms 344 KB Output isn't correct
14 Incorrect 2 ms 344 KB Output isn't correct
15 Incorrect 1 ms 344 KB Output isn't correct
16 Incorrect 13 ms 1460 KB Output isn't correct
17 Incorrect 13 ms 1368 KB Output isn't correct
18 Incorrect 14 ms 1236 KB Output isn't correct
19 Incorrect 13 ms 1368 KB Output isn't correct
20 Incorrect 5 ms 1368 KB Output isn't correct
21 Incorrect 57 ms 4348 KB Output isn't correct
22 Incorrect 59 ms 4176 KB Output isn't correct
23 Incorrect 56 ms 4248 KB Output isn't correct
24 Incorrect 55 ms 4176 KB Output isn't correct
25 Incorrect 58 ms 4176 KB Output isn't correct
26 Incorrect 54 ms 4176 KB Output isn't correct
27 Incorrect 54 ms 4212 KB Output isn't correct
28 Incorrect 54 ms 4176 KB Output isn't correct
29 Incorrect 53 ms 4180 KB Output isn't correct
30 Incorrect 24 ms 4184 KB Output isn't correct
31 Incorrect 0 ms 344 KB Output isn't correct
32 Incorrect 0 ms 344 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 KB Partially correct
2 Partially correct 0 ms 344 KB Partially correct
3 Partially correct 0 ms 344 KB Partially correct
4 Partially correct 0 ms 344 KB Partially correct
5 Partially correct 0 ms 344 KB Partially correct
6 Partially correct 0 ms 344 KB Partially correct
7 Partially correct 0 ms 344 KB Partially correct
8 Partially correct 0 ms 464 KB Partially correct
9 Partially correct 0 ms 344 KB Partially correct
10 Partially correct 0 ms 344 KB Partially correct
11 Partially correct 1 ms 344 KB Partially correct
12 Partially correct 1 ms 344 KB Partially correct
13 Partially correct 1 ms 344 KB Partially correct
14 Partially correct 1 ms 344 KB Partially correct
15 Partially correct 1 ms 344 KB Partially correct
16 Partially correct 13 ms 1368 KB Partially correct
17 Partially correct 13 ms 1368 KB Partially correct
18 Partially correct 13 ms 1368 KB Partially correct
19 Partially correct 13 ms 1368 KB Partially correct
20 Partially correct 5 ms 1368 KB Partially correct
21 Partially correct 57 ms 4276 KB Partially correct
22 Partially correct 53 ms 4184 KB Partially correct
23 Partially correct 56 ms 4176 KB Partially correct
24 Partially correct 52 ms 4176 KB Partially correct
25 Partially correct 60 ms 4200 KB Partially correct
26 Partially correct 66 ms 4108 KB Partially correct
27 Partially correct 58 ms 4176 KB Partially correct
28 Partially correct 54 ms 4176 KB Partially correct
29 Partially correct 56 ms 4308 KB Partially correct
30 Partially correct 32 ms 4156 KB Partially correct
31 Partially correct 0 ms 344 KB Partially correct
32 Partially correct 0 ms 344 KB Partially correct