답안 #1083371

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1083371 2024-09-03T03:32:51 Z dong_gas Gap (APIO16_gap) C++17
36.4576 / 100
70 ms 4320 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;
            MinMax(bef, b[i].first, &mn, &mx);
            ret = max(ret, mx - mn);
            bef = b[i].second;
        }
    }
    return ret;
}
# 결과 실행 시간 메모리 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 1 ms 344 KB Output isn't correct
15 Incorrect 1 ms 344 KB Output isn't correct
16 Incorrect 13 ms 1368 KB Output isn't correct
17 Incorrect 13 ms 1368 KB Output isn't correct
18 Incorrect 17 ms 1344 KB Output isn't correct
19 Incorrect 16 ms 1368 KB Output isn't correct
20 Incorrect 6 ms 1368 KB Output isn't correct
21 Incorrect 55 ms 4128 KB Output isn't correct
22 Incorrect 57 ms 4188 KB Output isn't correct
23 Incorrect 61 ms 4176 KB Output isn't correct
24 Incorrect 58 ms 4180 KB Output isn't correct
25 Incorrect 70 ms 4176 KB Output isn't correct
26 Incorrect 65 ms 4176 KB Output isn't correct
27 Incorrect 61 ms 4180 KB Output isn't correct
28 Incorrect 54 ms 4176 KB Output isn't correct
29 Incorrect 56 ms 4176 KB Output isn't correct
30 Incorrect 25 ms 4320 KB Output isn't correct
31 Incorrect 1 ms 344 KB Output isn't correct
32 Incorrect 1 ms 344 KB Output isn't correct
# 결과 실행 시간 메모리 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 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 1460 KB Partially correct
17 Partially correct 13 ms 1368 KB Partially correct
18 Partially correct 14 ms 1284 KB Partially correct
19 Partially correct 15 ms 1368 KB Partially correct
20 Partially correct 6 ms 1464 KB Partially correct
21 Partially correct 63 ms 4176 KB Partially correct
22 Partially correct 56 ms 4320 KB Partially correct
23 Partially correct 55 ms 4176 KB Partially correct
24 Partially correct 56 ms 4176 KB Partially correct
25 Partially correct 59 ms 4172 KB Partially correct
26 Partially correct 63 ms 4240 KB Partially correct
27 Partially correct 54 ms 4116 KB Partially correct
28 Partially correct 63 ms 4184 KB Partially correct
29 Partially correct 58 ms 4176 KB Partially correct
30 Partially correct 26 ms 4184 KB Partially correct
31 Partially correct 0 ms 344 KB Partially correct
32 Partially correct 0 ms 344 KB Partially correct