제출 #621443

#제출 시각아이디문제언어결과실행 시간메모리
621443misteg168기지국 (IOI20_stations)C++17
0 / 100
901 ms644 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll it = 0; void dfs(ll node, vector<vector<ll>> & adj, vector<bool> & vis, vector<int> & labels){ vis[node] = 1; labels[node] = it; //cout << node << "\n"; for(auto x : adj[node]){ if(vis[x]) continue; it++; dfs(x, adj, vis, labels); } } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { vector<int> labels(n); vector<vector<ll>> adj(n); for(int i = 0; i < (ll)u.size(); i++){ adj[ u[i] ].push_back( v[i] ); adj[ v[i] ].push_back( u[i] ); } for(int i = 0; i < n; i++){ if(adj[i].size() == 1){ vector<bool> vis(n); dfs( i, adj, vis, labels); break; } } //for(auto x : labels) cout << x << " "; //cout << "\n"; return labels; } int find_next_station(int s, int t, std::vector<int> c){ sort(c.begin(), c.end()); if(t > s && s != 0){ return c[1]; } 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...