# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544973 | PiejanVDC | Stations (IOI20_stations) | C++17 | 3064 ms | 2097152 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "stations.h"
using namespace std;
const int mxN = 1005;
vector<bitset<mxN>>mp(mxN);
vector<int>adj[mxN];
void dfs(int u, int e = -1) {
mp[u] |= 1 << u;
for(auto z : adj[u]) if(z != e) {
dfs(z,u);
mp[u] |= mp[z];
}
}
vector<int>label(int n, int k, vector<int>u, vector<int>v) {
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[z][t])
return z;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |