제출 #1292736

#제출 시각아이디문제언어결과실행 시간메모리
1292736ChuanChen기지국 (IOI20_stations)C++20
36.32 / 100
391 ms572 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1e4+3; vector<int> adj[MAXN]; int tin[MAXN], tout[MAXN], tempo; bool used[MAXN]; void dfs(int no){ used[no] = true; tin[no] = tempo++; for(int v : adj[no]) if(!used[v]){ dfs(v); } tout[no] = tempo; } inline int pre(int a); inline int pos(int a); vector<int> label(int n, int k, vector<int> u, vector<int> v){ for(int i = 0; i < n; i++){ used[i] = false; tin[i] = tout[i] = 0; adj[i].clear(); } tempo = 0; for (int i = 0; i < (int)u.size(); i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0); vector<int> labels(n); for (int i = 0; i < n; i++) { // labels[i] = 0; labels[i] = tin[i]*1001+tout[i]; // cerr << "i: " << i << " " << pre(labels[i]) << ' ' << pos(labels[i]) << endl; } return labels; } inline int pre(int a){ return a/1001; } inline int pos(int a){ return a%1001; } int find_next_station(int s, int t, vector<int> c) { if(pre(s) <= pre(t) && pos(t) <= pos(s)){ //t eh filho for(int l : c){ if(pre(l) <= pre(s) && pos(s) <= pos(l)) continue; if(pre(l) <= pre(t) && pos(t) <= pos(l)) return l; } } for(int l : c){ if(pre(l) <= pre(s) && pos(s) <= pos(l)) return l; } // return c[0]; }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:65:1: warning: control reaches end of non-void function [-Wreturn-type]
   65 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...