제출 #880056

#제출 시각아이디문제언어결과실행 시간메모리
880056JakobZorzGap (APIO16_gap)C++14
0 / 100
32 ms4556 KiB
#include"gap.h"
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

ll find_gap1(int n){
    vector<ll>vec1,vec2;
    ll l=0,r=1e18;
    while(true){
        MinMax(l,r,&l,&r);
        if(l==r){
            if(l!=-1)
                vec1.push_back(l);
            break;
        }
        vec1.push_back(l);
        vec2.push_back(r);
        l++;
        r--;
    }
    reverse(vec2.begin(),vec2.end());
    vec1.insert(vec1.end(),vec2.begin(),vec2.end());
    ll res=1e18;
    for(int i=1;i<n;i++)
        res=min(res,vec1[i]-vec1[i-1]);
    return res;
}

ll find_gap2(int n){
    return 0;
}

ll findGap(int t,int n){
    if(t==1){
        return find_gap1(n);
    }else{
        return find_gap2(n);
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...