Submission #1083370

# Submission time Handle Problem Language Result Execution time Memory
1083370 2024-09-03T03:30:32 Z dong_gas Gap (APIO16_gap) C++17
36.4576 / 100
68 ms 4364 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;
        ret = max(ret, mx - mn);
    }
    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;
            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 1 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 1 ms 392 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 1 ms 344 KB Output isn't correct
15 Incorrect 1 ms 344 KB Output isn't correct
16 Incorrect 15 ms 1368 KB Output isn't correct
17 Incorrect 14 ms 1464 KB Output isn't correct
18 Incorrect 13 ms 1464 KB Output isn't correct
19 Incorrect 14 ms 1368 KB Output isn't correct
20 Incorrect 7 ms 1368 KB Output isn't correct
21 Incorrect 58 ms 4184 KB Output isn't correct
22 Incorrect 68 ms 4176 KB Output isn't correct
23 Incorrect 61 ms 4128 KB Output isn't correct
24 Incorrect 58 ms 4176 KB Output isn't correct
25 Incorrect 66 ms 4176 KB Output isn't correct
26 Incorrect 64 ms 4176 KB Output isn't correct
27 Incorrect 66 ms 4176 KB Output isn't correct
28 Incorrect 63 ms 4180 KB Output isn't correct
29 Incorrect 56 ms 4176 KB Output isn't correct
30 Incorrect 26 ms 4184 KB Output isn't correct
31 Incorrect 1 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 1 ms 344 KB Partially correct
2 Partially correct 0 ms 344 KB Partially correct
3 Partially correct 1 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 1 ms 344 KB Partially correct
7 Partially correct 0 ms 344 KB Partially correct
8 Partially correct 0 ms 344 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 14 ms 1368 KB Partially correct
19 Partially correct 13 ms 1368 KB Partially correct
20 Partially correct 6 ms 1368 KB Partially correct
21 Partially correct 59 ms 4352 KB Partially correct
22 Partially correct 58 ms 4184 KB Partially correct
23 Partially correct 58 ms 4364 KB Partially correct
24 Partially correct 56 ms 4176 KB Partially correct
25 Partially correct 62 ms 4184 KB Partially correct
26 Partially correct 58 ms 4176 KB Partially correct
27 Partially correct 56 ms 4176 KB Partially correct
28 Partially correct 57 ms 4356 KB Partially correct
29 Partially correct 55 ms 4176 KB Partially correct
30 Partially correct 24 ms 4180 KB Partially correct
31 Partially correct 0 ms 344 KB Partially correct
32 Partially correct 0 ms 344 KB Partially correct