Submission #1083368

# Submission time Handle Problem Language Result Execution time Memory
1083368 2024-09-03T03:27:29 Z dong_gas Gap (APIO16_gap) C++17
36.4576 / 100
66 ms 4360 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) / n;
    for (ll i = a[1], cnt = 1; cnt <= n; i += gap, cnt++) {
        l[cnt] = i, r[cnt] = i + gap;
        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 0 ms 344 KB Output isn't correct
2 Incorrect 1 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 1 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 1 ms 344 KB Output isn't correct
10 Incorrect 1 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 12 ms 1464 KB Output isn't correct
17 Incorrect 15 ms 1368 KB Output isn't correct
18 Incorrect 13 ms 1464 KB Output isn't correct
19 Incorrect 15 ms 1368 KB Output isn't correct
20 Incorrect 6 ms 1368 KB Output isn't correct
21 Incorrect 60 ms 4356 KB Output isn't correct
22 Incorrect 57 ms 4356 KB Output isn't correct
23 Incorrect 65 ms 4176 KB Output isn't correct
24 Incorrect 60 ms 4332 KB Output isn't correct
25 Incorrect 60 ms 4140 KB Output isn't correct
26 Incorrect 56 ms 4308 KB Output isn't correct
27 Incorrect 56 ms 4176 KB Output isn't correct
28 Incorrect 54 ms 4176 KB Output isn't correct
29 Incorrect 57 ms 4176 KB Output isn't correct
30 Incorrect 24 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 0 ms 344 KB Partially correct
2 Partially correct 1 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 1 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 596 KB Partially correct
13 Partially correct 1 ms 344 KB Partially correct
14 Partially correct 1 ms 460 KB Partially correct
15 Partially correct 1 ms 340 KB Partially correct
16 Partially correct 13 ms 1368 KB Partially correct
17 Partially correct 13 ms 1460 KB Partially correct
18 Partially correct 13 ms 1368 KB Partially correct
19 Partially correct 14 ms 1368 KB Partially correct
20 Partially correct 5 ms 1300 KB Partially correct
21 Partially correct 54 ms 4356 KB Partially correct
22 Partially correct 55 ms 4296 KB Partially correct
23 Partially correct 64 ms 4236 KB Partially correct
24 Partially correct 66 ms 4360 KB Partially correct
25 Partially correct 59 ms 4140 KB Partially correct
26 Partially correct 53 ms 4176 KB Partially correct
27 Partially correct 56 ms 4272 KB Partially correct
28 Partially correct 55 ms 4176 KB Partially correct
29 Partially correct 56 ms 4184 KB Partially correct
30 Partially correct 24 ms 4184 KB Partially correct
31 Partially correct 0 ms 344 KB Partially correct
32 Partially correct 0 ms 344 KB Partially correct