# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
831380 | Trumling | 기지국 (IOI20_stations) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(x) x.begin(),x.end()
typedef long long ll;
#define pb push_back
#define INF 9999999999999999
vector<vector<int>>g;
ll nn;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
/*
g.assign(n,vector<int>());
for (int i = 0; i < n-1; i++) {
g[u[i]].pb(v[i]);
g[v[i]].pb(u[i]);
}
*/
nn =n;
vector<int>labels(n);
for(int i=0;i<n;i++)
labels[i]=i;
return labels;
}
int find_next_station(int s, int t, vector<int> c)
{
ll mini=INF;
for(auto x:c)
mini=min(x,mini);
if(t<s)
return mini;
queue<int>q;
q.push(s);
int tf=-1;
while(!q.empty())
{
ll curr=q.front();
q.pop();
if(curr*2+1 ==t)
{
tf=0;
break;
}
if(curr*2+2 ==t)
{
tf=1;
break;
}
if(curr*2+1<t)
q.push(curr*2+1);
if(curr*2+2<t)
q.push(curr*2+2);
}
if(tf==-1)
return mini;
if(tf==0)
return s*2+1;
else
return s*2+2;
}