# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
616565 | John3_141592 | Stations (IOI20_stations) | C++14 | 3 ms | 328 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 "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> grafo[1003];
int arr[1003],C;
bool vis[1003];
void dfs(int node){
vis[node]=true,arr[node]=0;
for(auto i:grafo[node]) if(!vis[i]) dfs(i),arr[node]&=arr[i];
arr[node]|=(1<<C),C++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for(int i=0;i<n;i++) grafo[i].clear();
for(int i=0;i<n-1;i++) grafo[u[i]].push_back(v[i]),grafo[v[i]].push_back(u[i]);
C=0,dfs(0);
vector <int> vec;
for(int i=0;i<n;i++) vec.push_back(arr[i]),cout<<i<<" "<<arr[i]<<"\n";
return vec;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(c.size()==1) return c[0];
for(auto i:c) if(i&t==t) return i;
return c.back();
}
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... |