# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
605579 | MohamedAliSaidane | Stations (IOI20_stations) | C++14 | 1190 ms | 776 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>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
const int nax = 1001;
vi rep;
int cureul = -1;
vi adj[nax];
void dfs(int x, int p = -1)
{
rep[x]= ++cureul;
for(auto e: adj[x])
if(e != p)
dfs(e, x);
rep[x] += 1000 * cureul;
}
vi label(int n, int k, vi u, vi v)
{
for(int i = 0 ; i < n; i++)
adj[i].clear();
cureul = -1;
rep.assign(n , 0);
for(int i= 0; i < n - 1; i ++)
{
adj[u[i]].pb(v[i]);
adj[v[i]].pb(u[i]);
}
dfs(0);
return rep;
}
int find_next_station(int s, int t, vi c)
{
int tin = s%1000;
int tout = s/1000;
int innt = t%1000;
int outt = t/1000;
if(innt >= tin && innt <= tout)
{
for(auto e: c)
{
int u = e/1000;
int v = e%1000;
if(innt >= v && innt <= u && v > tin)
return e;
}
}
else
{
for(auto e: c)
{
if(e%1000 < tin)
return e;
}
}
}
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... |