답안 #420315

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
420315 2021-06-08T09:38:34 Z NintsiChkhaidze 기지국 (IOI20_stations) C++14
컴파일 오류
0 ms 0 KB
#include "stations.hpp"
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define pb push_back
using namespace std;
vector <int> vec[1005],labels;
int cnt = 0,in[1005],out[1005];
void dfs(int x,int p,int t){
    in[x] = cnt++;
    if (t%2) labels[x] = in[x];
    
    for (int j=0;j<vec[x].size();j++){
        int to = vec[x][j];
        if (to == p) continue;
        dfs(to,x,t + 1);
    }
    out[x] = cnt++;
    if (!labels[x]) labels[x] = out[x];
}
 
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    for (int i=0;i<1001;i++){
        vec[i].clear();
        in[i] = out[i] = 0;
    }
    for (int i=0;i<u.size();i++){
        vec[u[i]].pb(v[i]);
        vec[v[i]].pb(u[i]);
    }
    
    cnt=0;
    labels.clear();
    for (int i=0;i<n;i++)
        labels.pb(0);
    dfs(0,0,0);
    return labels;
}
int find_next_station(int s, int t, vector<int> c) {
    sort(c.begin(),c.end());
    if (s > c[0]){
        //s - out
        for (int i = 1; i<c.size();i++){
            int l = c[i],r = s - 1;
            if (i!=c.size() - 1) r = c[i + 1] - 1;
            
            if (l <= t && t <= r) return c[i];
        }
        return c[0];
    }
    else{
        //s - in
        for (int i = 1; i<c.size(); i++){
            int l = s + 1,r = c[i];
            if (i > 1) l = c[i - 1] + 1;
            
            if (l <= t && t <= r) return c[i];
        }
        return c[0];
    }
}

Compilation message

stations.cpp:1:10: fatal error: stations.hpp: No such file or directory
    1 | #include "stations.hpp"
      |          ^~~~~~~~~~~~~~
compilation terminated.