답안 #187332

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
187332 2020-01-12T17:44:05 Z rzbt Gap (APIO16_gap) C++14
100 / 100
71 ms 1272 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define MAXN 100005
#include "gap.h"
typedef long long ll;


using namespace std;
ll findGap(int t,int n){
    if(t==1){ll res=0;
    ll l,d,tl,td;
    MinMax(0ll,1000000000000000000ll,&l,&d);
    while(n>2){

        MinMax(l+1,d-1,&tl,&td);
        //printf("   %lld  %lld      %lld %lld\n",l,d,tl,td);
        res=max(res,max(tl-l,d-td));
        l=tl;
        d=td;
        n-=2;
    }
    if(n==2)res=max(res,d-l);
    return res;
    }
    ll l,d,res=0;
    MinMax(0ll,1000000000000000000ll,&l,&d);
    ll korak=(d-l)/(n-1);
    ll tl=l+1,kolko,a,b;
    ll prosli=l;
    while(tl<=d){
        MinMax(tl,tl+korak, &a, &b);
        if(a==-1){
            tl+=korak+1;
        }else{
            res=max(res,a-prosli);
            prosli=b;
            tl+=korak+1;
        }
    }
    return res;


}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:32:15: warning: unused variable 'kolko' [-Wunused-variable]
     ll tl=l+1,kolko,a,b;
               ^~~~~
# 결과 실행 시간 메모리 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 292 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 380 KB Output is correct
14 Correct 3 ms 380 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
16 Correct 14 ms 504 KB Output is correct
17 Correct 14 ms 504 KB Output is correct
18 Correct 15 ms 504 KB Output is correct
19 Correct 15 ms 504 KB Output is correct
20 Correct 11 ms 504 KB Output is correct
21 Correct 53 ms 1144 KB Output is correct
22 Correct 53 ms 1064 KB Output is correct
23 Correct 53 ms 1260 KB Output is correct
24 Correct 53 ms 1144 KB Output is correct
25 Correct 45 ms 1144 KB Output is correct
26 Correct 53 ms 1144 KB Output is correct
27 Correct 53 ms 1060 KB Output is correct
28 Correct 53 ms 1272 KB Output is correct
29 Correct 53 ms 1144 KB Output is correct
30 Correct 39 ms 1272 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 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 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 380 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 18 ms 504 KB Output is correct
17 Correct 19 ms 504 KB Output is correct
18 Correct 18 ms 548 KB Output is correct
19 Correct 19 ms 504 KB Output is correct
20 Correct 9 ms 504 KB Output is correct
21 Correct 71 ms 1272 KB Output is correct
22 Correct 70 ms 1192 KB Output is correct
23 Correct 70 ms 1192 KB Output is correct
24 Correct 70 ms 1144 KB Output is correct
25 Correct 65 ms 1192 KB Output is correct
26 Correct 71 ms 1144 KB Output is correct
27 Correct 70 ms 1144 KB Output is correct
28 Correct 70 ms 1076 KB Output is correct
29 Correct 71 ms 1144 KB Output is correct
30 Correct 37 ms 1144 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 2 ms 376 KB Output is correct