제출 #1353829

#제출 시각아이디문제언어결과실행 시간메모리
1353829marizaTheseus (CEOI25_theseus)C++20
11 / 100
268 ms476548 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll N=1e4;

vector<ll> g[N];
ll d[N];
void dfs(ll curr, ll prev){
    for(auto nxt:g[curr]){
        if(nxt!=prev){
            d[nxt]=d[curr]+1;
            dfs(nxt,curr);
        }
    }
}

vector<int> paint(int n, vector<pair<int,int>> e, int t){
    t--;
    for(auto i:e){
        ll u, v;
        tie(u,v)=i; u--; v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    d[t]=0;
    dfs(t,t);

    vector<int> ans;
    for(auto i:e){
        ll u, v;
        tie(u,v)=i; u--; v--;
        
        if(d[max(u,v)]>d[min(u,v)]) ans.push_back(0);
        else ans.push_back(1);
    }
    return ans;
}

int travel(int n, int u, vector<pair<int,int>> nxt) {
    for(auto i:nxt){
        if((i.second==1 && i.first>u) || (i.second==0 && i.first<u)) return i.first;
    }
}

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

theseus.cpp: In function 'int travel(int, int, std::vector<std::pair<int, int> >)':
theseus.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…