답안 #95680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
95680 2019-02-02T07:39:03 Z dwsc Gap (APIO16_gap) C++14
89.0375 / 100
102 ms 1924 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int T, int N)
{
    if (T == 1){
    long long arr[N];
    long long x1,x2;
    long long low = 0,high = 1e18;
    for (int i = 0; i < (N+1)/2; i++){
        MinMax(low,high,&x1,&x2);
        arr[i] = x1,arr[N-i-1] = x2;
        low = x1+1,high = x2-1;
    }
    long long ans = 0;
    for (int i = 0; i < N-1; i++) ans = max(ans,arr[i+1]-arr[i]);
    return ans;
    }
    long long low,high;
    MinMax(0,1e18,&low,&high);
    long long gap = (high-low)/(N-1);
    long long prev = low;
    long long ans = 0;
    long long t1,t2;
    for (long long lower = low; lower < high; lower += gap){
        MinMax(lower+1,lower+gap,&t1,&t2);
       // cout << lower << t1 << " " << t2 << "\n";
        if (t1 != -1) ans = max(ans,t1-prev);
        if (t2 != -1) prev = t2;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 13 ms 656 KB Output is correct
17 Correct 13 ms 760 KB Output is correct
18 Correct 13 ms 768 KB Output is correct
19 Correct 12 ms 676 KB Output is correct
20 Correct 10 ms 744 KB Output is correct
21 Correct 47 ms 1900 KB Output is correct
22 Correct 46 ms 1824 KB Output is correct
23 Correct 47 ms 1924 KB Output is correct
24 Correct 47 ms 1904 KB Output is correct
25 Correct 39 ms 1912 KB Output is correct
26 Correct 47 ms 1872 KB Output is correct
27 Correct 46 ms 1908 KB Output is correct
28 Correct 48 ms 1920 KB Output is correct
29 Correct 46 ms 1852 KB Output is correct
30 Correct 36 ms 1832 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 372 KB Output is correct
8 Correct 2 ms 424 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 17 ms 580 KB Output is correct
17 Correct 17 ms 576 KB Output is correct
18 Correct 17 ms 580 KB Output is correct
19 Correct 16 ms 504 KB Output is correct
20 Partially correct 8 ms 504 KB Partially correct
21 Correct 64 ms 1164 KB Output is correct
22 Correct 65 ms 1164 KB Output is correct
23 Correct 79 ms 1168 KB Output is correct
24 Correct 63 ms 1184 KB Output is correct
25 Correct 58 ms 1160 KB Output is correct
26 Correct 102 ms 1164 KB Output is correct
27 Correct 65 ms 1172 KB Output is correct
28 Correct 63 ms 1160 KB Output is correct
29 Correct 64 ms 1156 KB Output is correct
30 Partially correct 34 ms 1144 KB Partially correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct