# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592457 | PiejanVDC | Stations (IOI20_stations) | C++17 | 896 ms | 1188 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;
vector<int>label(int n, int k, vector<int>u, vector<int>v) {
vector<int>l(n);
for(int i = 0 ; i < n ; i++)
l[i] = i;
return l;
}
vector<set<int>>sub(1005);
void dfs(int u) {
if(2*u+1 < 1000) {
dfs(2*u+1);
for(auto it = sub[2*u+1].begin() ; it != sub[2*u+1].end() ; it++)
sub[u].insert(*it);
}
if(2*u+2 < 1000) {
dfs(2*u+2);
for(auto it = sub[2*u+2].begin() ; it != sub[2*u+2].end() ; it++)
sub[u].insert(*it);
}
sub[u].insert(u);
}
void gen() {
const int n = 1000;
dfs(0);
}
bool f;
int find_next_station(int s, int t, vector<int>c) {
if(!f)
gen();
f = 1;
for(int i = 1 ; i < (int)c.size() ; i++)
if(sub[c[i]].find(t) != sub[c[i]].end())
return c[i];
return c[0];
}
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... |