# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
305089 | 2020-09-22T14:50:50 Z | Theo830 | 기지국 (IOI20_stations) | C++14 | 0 ms | 0 KB |
#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); }