답안 #197493

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
197493 2020-01-21T13:10:07 Z handlename Gap (APIO16_gap) C++17
100 / 100
73 ms 3084 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
long long ans,mini,maxi;
long long findGap(int t, int n){
    maxi=1e18;
    MinMax(0,1e18,&mini,&maxi);
    if (t==1){
        for (int i=1;i<(n+1)/2;i++){
            long long cur1,cur2;
            MinMax(mini+1,maxi-1,&cur1,&cur2);
            ans=max(ans,cur1-mini);
            ans=max(ans,maxi-cur2);
            mini=cur1;
            maxi=cur2;
        }
        ans=max(ans,maxi-mini);
    }
    else {
        if (n==2) return maxi-mini;
        long long size=maxi-mini+1;
        long long l=mini+1,lastguy=mini;
        for (int i=1;i<n;i++){
            long long cur1,cur2;
            long long curr=l+size/(n-1)-1;
            if (i<(size)%(n-1)) curr++;
            MinMax(l,curr,&cur1,&cur2);
            if (cur1!=-1){
                ans=max(ans,cur1-lastguy);
                lastguy=cur2;
            }
            l=curr+1;
        }
        ans=max(ans,l-lastguy);
    }
    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 372 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 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 15 ms 1056 KB Output is correct
17 Correct 15 ms 1016 KB Output is correct
18 Correct 15 ms 1016 KB Output is correct
19 Correct 15 ms 1016 KB Output is correct
20 Correct 11 ms 764 KB Output is correct
21 Correct 54 ms 2936 KB Output is correct
22 Correct 53 ms 2936 KB Output is correct
23 Correct 54 ms 2936 KB Output is correct
24 Correct 54 ms 3040 KB Output is correct
25 Correct 46 ms 2344 KB Output is correct
26 Correct 55 ms 2936 KB Output is correct
27 Correct 54 ms 3000 KB Output is correct
28 Correct 54 ms 2944 KB Output is correct
29 Correct 55 ms 3020 KB Output is correct
30 Correct 39 ms 1788 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 424 KB Output is correct
5 Correct 2 ms 296 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 1 ms 376 KB Output is correct
8 Correct 2 ms 376 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 424 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 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 19 ms 1016 KB Output is correct
17 Correct 26 ms 1044 KB Output is correct
18 Correct 19 ms 1016 KB Output is correct
19 Correct 19 ms 1016 KB Output is correct
20 Correct 10 ms 632 KB Output is correct
21 Correct 72 ms 3084 KB Output is correct
22 Correct 71 ms 2936 KB Output is correct
23 Correct 54 ms 2936 KB Output is correct
24 Correct 73 ms 2936 KB Output is correct
25 Correct 69 ms 2380 KB Output is correct
26 Correct 73 ms 2936 KB Output is correct
27 Correct 71 ms 3044 KB Output is correct
28 Correct 72 ms 2940 KB Output is correct
29 Correct 72 ms 2936 KB Output is correct
30 Correct 39 ms 1784 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct