제출 #1139944

#제출 시각아이디문제언어결과실행 시간메모리
1139944AlmontherStations (IOI20_stations)C++20
컴파일 에러
0 ms0 KiB
// #include "stations.h"
#include <bits/stdc++.h>

#define ll int
#define co cout<<
using namespace std;
//stuff
const ll maxn=1005;
ll en[maxn],ou[maxn],a[maxn];
vector<ll>v1[maxn];
map<ll,ll>mp;
ll tim=1;
ll dfs(ll x,ll last,ll dep){
    en[x]=tim++;
    for(auto i:v1[x]){
        if(i!=last) dfs(i,x,dep+1);
    }
    ou[x]=tim++;
    if(dep%2) mp[ou[x]],a[x]=ou[x];
    else mp[en[x]],a[x]=en[x];
}
vector<int>label(int n, int k, vector<int> u, vector<int> v){
    for(int i=0;i<u.size();i++) v1[u[i]].push_back(v[i]);
    dfs(1,0,1);
    ll cnt=0;
    for(auto &i:mp) i.second=cnt++;
    vector<int>labels;
    for(int i=1;i<=n;i++) labels.push_back(mp[a[i]]);
    return labels;
}
int find_next_station(int s, int t, vector<int> c) {
    set<ll>s1;
    for(auto i:c) s1.insert(i);
    ll parent;
    ll l,r;
    if(s<*s1.begin()){
        auto it=s1.end();
        it--;
        parent=*it;
        s1.erase(it);
        it=s1.end();
        it--;
        l=s;
        r=*it;
        if(!(l<=t&&t<=r)) return parent;
        // even i'm the ending time
        // they have the starting
        vector<ll>v;
        for(auto i:s1) v.push_back(i);
        for(int i=0;i<v.size()-1;i++){
            if(v[i]<=t&&t<=v[i+1]) return v[i];
        }
        return v.back();
    }
    else{
        parent=*s1.begin();
        s1.erase(s1.begin());
        l=*s1.begin();
        r=s;
        if(!(l<=t&&t<=r)) return parent;
        // odd they have the finishing i have the starting
        vector<ll>v;
        for(auto i:s1) v.push_back(i);
        for(int i=v.size()-1;i>0;i--){
            if(v[i]>=t&&t>=v[i-1]) return v[i];
        }
        return v[0];
    }
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int _=1;
    // cin>>_;
    // while(_--) solve();
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'int dfs(int, int, int)':
stations.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
   21 | }
      | ^
/usr/bin/ld: /tmp/ccGVP0GZ.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc22d1pp.o:stations.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status