제출 #1292686

#제출 시각아이디문제언어결과실행 시간메모리
1292686ChuanChen기지국 (IOI20_stations)C++20
0 / 100
2 ms540 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1e3+3; vector<int> adj[MAXN]; int tin[MAXN], tout[MAXN], tempo; void dfs(int no, int anc){ assert(tempo <= 1000); tin[no] = tempo++; for(int v : adj[no]) if(v != anc){ dfs(v, no); } tout[no] = tempo; } vector<int> label(int n, int k, vector<int> u, vector<int> v){ for(int i = 0; i < n; i++) adj[i].clear(); tempo = 0; for (int i = 0; i < n; i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0, 0); vector<int> labels(n); for (int i = 0; i < n; i++) { labels[i] = 0; // labels[i] = tin[i]*1000+tout[i]; } return labels; } inline int pre(int a){ return a/1000; } inline int pos(int a){ return a%1000; } 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)){ //t eh meu filho return l; } } } for(int l : c){ if(pre(l) <= pre(s) && pos(s) <= pos(l)) return l; } return c[0]; }
#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...