# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869678 | andrewp | Stations (IOI20_stations) | C++14 | 1 ms | 384 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.
//Dedicated to my love,ivaziva
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
#define ll long long
#define pb push_back
const int maxn=1050;
const int mx=2000;
const int mod=998244353;
vector<int> es[maxn]; //ivice
int tin[maxn],tout[maxn];
int vu=0,vi=0;//vreme ulaza, vreme izlaza
void dfs(int u,int par){
tin[u]=vu++;
for(auto e:es[u]){
if(e!=par){
dfs(e,u);
}
}
tout[u]=vi++;
}
vector<int> label(int n,int k,vector<int> u,vector<int> v){
vector<int> kodiraj(n+1,0);
for(int i=0;i<v.size();i++) u[i]++,v[i]++;//indeksiram od 1
for(int i=0;i<v.size();i++){
es[u[i]].pb(v[i]);
es[v[i]].pb(u[i]);
}
vu=0,vi=0;
dfs(1,-1);
for(int i=1;i<=n;i++){
kodiraj[i]=tin[i]*mx+tout[i];//tout[i]<=2k
}
return kodiraj;
}
int find_next_station(int s,int e,vector<int> c){
if(e/mx<s/mx||e%mx>s%mx){
for(auto p:c){
if(p/mx<=s/mx) return p;
}
}
for(auto p:c){
int x=p/mx,y=p%mx;
if(x>s/mx&&x<=e/mx&&y>=e%mx) return p;
}
}
// void sol(){
// }
// int main(){
// int T=1;
// // scanf("%d",&T);
// while(T--){
// sol();
// }
// return 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... |