답안 #570727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
570727 2022-05-31T07:34:53 Z YouAreMyGalaxy Gap (APIO16_gap) C++17
100 / 100
58 ms 1872 KB
//Make CSP great again
//Vengeance
#include <bits/stdc++.h>
#include "gap.h"
#define TASK "TESTCODE"
#define Log2(x) 31 - __builtin_clz(x)
using namespace std;
const int N = 1e5;
long long a[N + 2];
long long findGap(int t, int n)
{
    if (t == 1)
    {
        a[0] = -1;
        a[n + 1] = 2e18 + 1;
        for (int i = 1, j = n; i <= j; ++ i, -- j)
        {
            MinMax(a[i - 1] + 1, a[j + 1] - 1, &a[i], &a[j]);
        }
        long long res = 0;
        for (int i = 2; i <= n; ++ i)
        {
            res = max(res, a[i] - a[i - 1]);
        }
        return res;
    }
    long long res = 0;
    long long mn, mx;
    MinMax(0, 1e18, &mn, &mx);
    long long maxPre = -1;
    long long tmn, tmx;
    tmn = mn;
    tmx = mx;
    if (n == 2)
    {
        return mx - mn;
    }
    --n;
    for (long long l = tmn; l < tmx; l += (tmx - tmn)/n + 1)
    {
        MinMax(l, l + (tmx - tmn)/n, &mn, &mx);
        if (mn == -1)
        {
            continue;
        }
        if (maxPre != -1)
        {
            res = max(res, mn - maxPre);
        }
        maxPre = mx;
    }
    return res;
}
/*void read()
{
 
}
void solve()
{
 
}
int  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    if (fopen(TASK".INP", "r"))
    {
        freopen(TASK".INP", "r", stdin);
        //freopen(TASK".OUT", "w", stdout);
    }
    int t = 1;
    bool typetest = false;
    if (typetest)
    {
        cin >> t;
    }
    for (int __ = 1; __ <= t; ++ __)
    {
        //cout << "Case " << __ << ": ";
        read();
        solve();
    }
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 2 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 12 ms 712 KB Output is correct
17 Correct 11 ms 572 KB Output is correct
18 Correct 10 ms 592 KB Output is correct
19 Correct 10 ms 688 KB Output is correct
20 Correct 7 ms 592 KB Output is correct
21 Correct 39 ms 1836 KB Output is correct
22 Correct 37 ms 1748 KB Output is correct
23 Correct 44 ms 1872 KB Output is correct
24 Correct 41 ms 1772 KB Output is correct
25 Correct 32 ms 1864 KB Output is correct
26 Correct 45 ms 1856 KB Output is correct
27 Correct 37 ms 1816 KB Output is correct
28 Correct 37 ms 1840 KB Output is correct
29 Correct 40 ms 1748 KB Output is correct
30 Correct 37 ms 1776 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 2 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 12 ms 432 KB Output is correct
17 Correct 14 ms 412 KB Output is correct
18 Correct 14 ms 428 KB Output is correct
19 Correct 12 ms 464 KB Output is correct
20 Correct 9 ms 520 KB Output is correct
21 Correct 56 ms 968 KB Output is correct
22 Correct 56 ms 1064 KB Output is correct
23 Correct 52 ms 968 KB Output is correct
24 Correct 50 ms 964 KB Output is correct
25 Correct 48 ms 1052 KB Output is correct
26 Correct 58 ms 968 KB Output is correct
27 Correct 56 ms 1084 KB Output is correct
28 Correct 58 ms 1088 KB Output is correct
29 Correct 51 ms 968 KB Output is correct
30 Correct 28 ms 976 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct