# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
835230 | DJeniUp | Stations (IOI20_stations) | C++17 | 3045 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 "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define N 1007
ll n,tin[N],tout[N],h;
vector<int>v[N],res;
ll S(ll x,ll y){
tin[x]=h;
tout[x]=h;
h++;
for(int i=0;i<v[x].size();i++){
if(v[x][i]!=y){
tout[x]=S(v[x][i],x);
}
}
return tout[x];
}
std::vector<int> label(int N1, int k, std::vector<int> u, std::vector<int> w) {
n=N1;
res.resize(n);
for(int i=0;i<u.size();i++){
v[u[i]].pb(w[i]);
v[w[i]].pb(u[i]);
}
S(0,0);
for(int i=0;i<n;i++){
res[i]=tin[i]*1000+tout[i];
}
return res;
}
int find_next_station(int s, int t, std::vector<int> c) {
exit(0);
n=c.size();
ll tin1=s/1000;
ll tout1=s%1000;
ll tin2=t/1000;
ll tout2=t%1000;
for(int i=0;i<n;i++){
tin[i]=c[i]/1000;
tout[i]=c[i]%1000;
}
if(tin1<=tin2 && tout2<=tout1){
for(int i=0;i<n;i++){
if(tin[i]<=tin2 && tout2<=tout[i])return c[i];
}
}else{
for(int i=0;i<n;i++){
if(tin[i]<tin1)return c[i];
}
}
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... |