제출 #1353866

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

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

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

    ll dist[n]; dist[t]=0;
    queue<ll> q; q.push(t);
    bool vis[n]={}; vis[t]=1;
    while(!q.empty()){
        ll curr=q.front();
        q.pop();

        for(auto nxt:g[curr]){
            if(!vis[nxt]){
                dist[nxt]=dist[curr]+1;
                vis[curr]=1;
                q.push(nxt);
            }
        }
    }

    for(ll i=0; i<n; i++){
        cout<<i<<": "<<dist[i]<<endl;
    }

    vector<int> ans;
    for(auto i:e){
        ll u, v;
        tie(u,v)=i; u--; v--;
        
        if(dist[v]<dist[u]){  // u -> v
            if(u<v) ans.push_back(1);
            else ans.push_back(0);
        }
        else{  // v -> u
            if(u>v) ans.push_back(1);
            else ans.push_back(0);
        }
    }
    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:58:1: warning: control reaches end of non-void function [-Wreturn-type]
   58 | }
      | ^
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…