제출 #545185

#제출 시각아이디문제언어결과실행 시간메모리
545185PiejanVDC기지국 (IOI20_stations)C++17
0 / 100
2017 ms1400 KiB
#include <bits/stdc++.h> #include "stations.h" using namespace std; const int mxN = 1005; map<pair<int,int>, bitset<mxN>>mp; vector<int>adj[mxN]; bitset<mxN> dfs(int u, int e = -1) { bitset<mxN>b; for(auto z : adj[u]) if(z != e) { mp[{u,z}] |= dfs(z,u); mp[{u,z}][z] = 1; b |= mp[{u,z}]; } return b; } void prep() { for(int i = 0 ; i < mxN ; i++) adj[i].clear(); mp.clear(); } vector<int>label(int n, int k, vector<int>u, vector<int>v) { prep(); for(int i = 0 ; i < n-1 ; i++) adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]); vector<int>ret(n); for(int i = 0 ; i < n ; i++) { dfs(i); ret[i] = i; } return ret; } int find_next_station(int s, int t, vector<int>c) { for(auto z : c) { if(mp[{s,z}][t]) return z; } assert(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...