답안 #956283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956283 2024-04-01T13:50:53 Z Nelt Gap (APIO16_gap) C++17
30 / 100
2000 ms 3880 KB
#include "gap.h"
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;

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;
    }
    ll mn, mx;
    MinMax(0, 1e18, &mn, &mx);
    ll l = (mx - mn + n - 1) / n, r = mx - mn;
    while (l <= r)
    {
        ll mid = (l + r) >> 1, cur = mn, x, y;
        bool ok = false;
        while (cur + mid <= mx)
        {
            MinMax(cur + 1, cur + mid - 1, &x, &y);
            if (x == -1)
            {
                // mn = cur;
                ok = true;
                // break;
            }
            cur = y;
        }
        if (ok)
            l = mid + 1;
        else
            r = mid - 1;
    }
    return --l;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 2 ms 2392 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 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 2 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 2588 KB Output is correct
18 Correct 8 ms 2584 KB Output is correct
19 Correct 9 ms 2580 KB Output is correct
20 Correct 7 ms 2532 KB Output is correct
21 Correct 30 ms 3620 KB Output is correct
22 Correct 30 ms 3636 KB Output is correct
23 Correct 30 ms 3652 KB Output is correct
24 Correct 30 ms 3648 KB Output is correct
25 Correct 27 ms 3620 KB Output is correct
26 Correct 30 ms 3632 KB Output is correct
27 Correct 30 ms 3840 KB Output is correct
28 Correct 31 ms 3880 KB Output is correct
29 Correct 30 ms 3628 KB Output is correct
30 Correct 25 ms 3620 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3034 ms 2392 KB Time limit exceeded
2 Execution timed out 3044 ms 2392 KB Time limit exceeded
3 Execution timed out 3028 ms 2644 KB Time limit exceeded
4 Execution timed out 3069 ms 2392 KB Time limit exceeded
5 Execution timed out 3040 ms 2644 KB Time limit exceeded
6 Execution timed out 3052 ms 2392 KB Time limit exceeded
7 Execution timed out 3038 ms 2392 KB Time limit exceeded
8 Execution timed out 3051 ms 2392 KB Time limit exceeded
9 Execution timed out 3046 ms 2392 KB Time limit exceeded
10 Execution timed out 3038 ms 2392 KB Time limit exceeded
11 Execution timed out 3040 ms 2392 KB Time limit exceeded
12 Execution timed out 3051 ms 2392 KB Time limit exceeded
13 Execution timed out 3060 ms 2392 KB Time limit exceeded
14 Execution timed out 3027 ms 2392 KB Time limit exceeded
15 Execution timed out 3046 ms 2392 KB Time limit exceeded
16 Execution timed out 3045 ms 2584 KB Time limit exceeded
17 Execution timed out 3024 ms 2540 KB Time limit exceeded
18 Execution timed out 3100 ms 2588 KB Time limit exceeded
19 Execution timed out 3033 ms 2580 KB Time limit exceeded
20 Execution timed out 3009 ms 2572 KB Time limit exceeded
21 Execution timed out 3053 ms 2860 KB Time limit exceeded
22 Execution timed out 3039 ms 3104 KB Time limit exceeded
23 Execution timed out 3011 ms 2864 KB Time limit exceeded
24 Execution timed out 3033 ms 2860 KB Time limit exceeded
25 Execution timed out 3038 ms 2860 KB Time limit exceeded
26 Execution timed out 3058 ms 3120 KB Time limit exceeded
27 Execution timed out 3052 ms 2864 KB Time limit exceeded
28 Execution timed out 3019 ms 2820 KB Time limit exceeded
29 Execution timed out 3020 ms 2864 KB Time limit exceeded
30 Execution timed out 3011 ms 2852 KB Time limit exceeded
31 Execution timed out 3030 ms 2392 KB Time limit exceeded
32 Execution timed out 3009 ms 2392 KB Time limit exceeded