답안 #880055

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
880055 2023-11-28T16:34:25 Z JakobZorz Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include"gap.h"
#include<iostream>
#include<vector>
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);
    }
}

Compilation message

gap.cpp: In function 'll find_gap1(int)':
gap.cpp:22:5: error: 'reverse' was not declared in this scope
   22 |     reverse(vec2.begin(),vec2.end());
      |     ^~~~~~~