# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
305089 | Theo830 | 기지국 (IOI20_stations) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
#define f(i,a,b) for(ll i = a;i < b;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vll vector<ll>
#define pb push_back
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Training
bool isin(ll l,ll r,ll x){
return (l <= x && x <= r);
}
int find_next_station(int s,int t,vector<int> c){
ll tins,touts;
if(s < c[0]){
tins = s;
touts = c.back();
if(!isin(tins,touts,t)){
return c.back();
}
else{
for(auto x:c){
if(t <= x){
return x;
}
}
}
}
else{
touts = s;
tins = c[0];
if(!isin(tins,touts,t)){
return c[0];
}
else{
reverse(c.begin(),c.end());
for(auto x:c){
if(x <= t){
return x;
}
}
}
}
assert(0);
}