답안 #464754

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464754 2021-08-13T22:11:04 Z nickmet2004 Gap (APIO16_gap) C++11
100 / 100
61 ms 1216 KB
#include<bits/stdc++.h>
#include "gap.h"
#define ll long long
using namespace std;

ll findGap(int T , int n){
    ll x = 0 , y = 1e18 ,mn , mx , ans = 0;
    if(T == 1){
        MinMax(x , y , &mn , &mx);
        x = mn , y = mx;
        for(int i = 1; i < (n + 1) /2; ++i){
            MinMax(x+1 , y-1 , &mn , &mx);
            ans = max({ans, y - mx , mn - x});
            x = mn , y =mx;
        }
    return max(ans , mx-mn);
    }
     //1 2 3 4 5 6
    MinMax(0 , 1e18 , &mn , &mx);
    ll sz = ans = (mx- mn) / (n - 1);
    x = mn , y = mx;
    //1  4  6 30
    ll lst = 1e18;
    for(ll i = x; i < y; i += sz+1){
        MinMax(i , i + sz , &mn , &mx);
        if(mn == -1)continue;
        ans = max(ans , mn - lst);
        lst = mx;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 0 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 0 ms 200 KB Output is correct
9 Correct 0 ms 200 KB Output is correct
10 Correct 0 ms 200 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 328 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 10 ms 516 KB Output is correct
17 Correct 10 ms 456 KB Output is correct
18 Correct 11 ms 460 KB Output is correct
19 Correct 10 ms 516 KB Output is correct
20 Correct 8 ms 456 KB Output is correct
21 Correct 41 ms 1028 KB Output is correct
22 Correct 41 ms 1036 KB Output is correct
23 Correct 42 ms 980 KB Output is correct
24 Correct 46 ms 1048 KB Output is correct
25 Correct 37 ms 1032 KB Output is correct
26 Correct 42 ms 960 KB Output is correct
27 Correct 41 ms 1092 KB Output is correct
28 Correct 43 ms 960 KB Output is correct
29 Correct 43 ms 1068 KB Output is correct
30 Correct 33 ms 1096 KB Output is correct
31 Correct 0 ms 200 KB Output is correct
32 Correct 0 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 0 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 0 ms 200 KB Output is correct
9 Correct 0 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 1 ms 328 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 14 ms 456 KB Output is correct
17 Correct 14 ms 456 KB Output is correct
18 Correct 14 ms 392 KB Output is correct
19 Correct 14 ms 456 KB Output is correct
20 Correct 7 ms 456 KB Output is correct
21 Correct 59 ms 1056 KB Output is correct
22 Correct 57 ms 960 KB Output is correct
23 Correct 58 ms 1052 KB Output is correct
24 Correct 59 ms 960 KB Output is correct
25 Correct 54 ms 1080 KB Output is correct
26 Correct 61 ms 1216 KB Output is correct
27 Correct 57 ms 1092 KB Output is correct
28 Correct 57 ms 984 KB Output is correct
29 Correct 55 ms 1180 KB Output is correct
30 Correct 33 ms 960 KB Output is correct
31 Correct 0 ms 200 KB Output is correct
32 Correct 1 ms 220 KB Output is correct