답안 #956294

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956294 2024-04-01T14:23:44 Z Nelt Gap (APIO16_gap) C++17
30 / 100
1763 ms 524288 KB
#include "gap.h"
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll solve(ll l, ll r)
{
    if (l == -1)
        return 0;
    ll mid = (l + r) >> 1, x, y, x1, y1;
    MinMax(l, mid, &x, &y);
    MinMax(l, mid, &x1, &y1);
    return max({solve(x, y), solve(x1, y1), x1 - y});
}
ll findGap(int t, int n)
{
    if (t == 1)
    {
        ll ans = 0;
        ll a[n];
        ll l = 0, r = 1e18, i = 0, j = n - 1;
        while (i <= j)
        {
            MinMax(l, r, &a[i], &a[j]);
            l = a[i++] + 1;
            r = a[j--] - 1;
        }
        for (ll i = 0; i + 1 < n; i++)
            ans = max(ans, a[i + 1] - a[i]);
        return ans;
    }
    return solve(0, 1e18);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2488 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 0 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2392 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 8 ms 2592 KB Output is correct
17 Correct 8 ms 2584 KB Output is correct
18 Correct 8 ms 2588 KB Output is correct
19 Correct 8 ms 2580 KB Output is correct
20 Correct 7 ms 2836 KB Output is correct
21 Correct 30 ms 3640 KB Output is correct
22 Correct 30 ms 3624 KB Output is correct
23 Correct 30 ms 3628 KB Output is correct
24 Correct 31 ms 3556 KB Output is correct
25 Correct 27 ms 3620 KB Output is correct
26 Correct 31 ms 3576 KB Output is correct
27 Correct 30 ms 3628 KB Output is correct
28 Correct 31 ms 3632 KB Output is correct
29 Correct 30 ms 3624 KB Output is correct
30 Correct 25 ms 3608 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 0 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 467 ms 524288 KB Execution killed with signal 9
2 Runtime error 575 ms 524288 KB Execution killed with signal 9
3 Runtime error 546 ms 524288 KB Execution killed with signal 9
4 Runtime error 565 ms 524288 KB Execution killed with signal 9
5 Runtime error 560 ms 524288 KB Execution killed with signal 9
6 Runtime error 734 ms 524288 KB Execution killed with signal 9
7 Runtime error 740 ms 524288 KB Execution killed with signal 9
8 Runtime error 738 ms 524288 KB Execution killed with signal 9
9 Runtime error 778 ms 524288 KB Execution killed with signal 9
10 Runtime error 732 ms 524288 KB Execution killed with signal 9
11 Runtime error 1103 ms 524288 KB Execution killed with signal 9
12 Runtime error 1060 ms 524288 KB Execution killed with signal 9
13 Runtime error 1090 ms 524288 KB Execution killed with signal 9
14 Runtime error 1068 ms 524288 KB Execution killed with signal 9
15 Runtime error 1095 ms 524288 KB Execution killed with signal 9
16 Runtime error 1549 ms 524288 KB Execution killed with signal 9
17 Runtime error 1525 ms 524288 KB Execution killed with signal 9
18 Runtime error 1534 ms 524288 KB Execution killed with signal 9
19 Runtime error 1505 ms 524288 KB Execution killed with signal 9
20 Runtime error 1519 ms 524288 KB Execution killed with signal 9
21 Runtime error 1763 ms 524288 KB Execution killed with signal 9
22 Runtime error 1752 ms 524288 KB Execution killed with signal 9
23 Runtime error 1754 ms 524288 KB Execution killed with signal 9
24 Runtime error 1753 ms 524288 KB Execution killed with signal 9
25 Runtime error 1744 ms 524288 KB Execution killed with signal 9
26 Runtime error 1739 ms 524288 KB Execution killed with signal 9
27 Runtime error 1747 ms 524288 KB Execution killed with signal 9
28 Runtime error 1751 ms 524288 KB Execution killed with signal 9
29 Runtime error 1756 ms 524288 KB Execution killed with signal 9
30 Runtime error 1733 ms 524288 KB Execution killed with signal 9
31 Runtime error 746 ms 524288 KB Execution killed with signal 9
32 Runtime error 760 ms 524288 KB Execution killed with signal 9