# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
826620 | Marco_Escandon | Stations (IOI20_stations) | C++17 | 733 ms | 696 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 <vector>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll vis=0;
vector<int> sol;
vector<vector<ll>> cad;
void dfs(ll node,ll p, ll p2)
{
if(p2%2==0)
{
sol[node]=vis;
vis++;
}
for(auto i:cad[node])
{
if(i!=p)
{
dfs(i,node,p2+1);
}
}
if(p2%2==1)
{
sol[node]=vis;
vis++;
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
cad.assign(n+5,vector<ll>());
for(int i=0; i<u.size(); i++)
{
cad[u[i]].push_back(v[i]);
cad[v[i]].push_back(u[i]);
}
sol.clear();;
sol.assign(n,0);
dfs(0,-1,2);
return sol;
}
int find_next_station(int s, int t, std::vector<int> c) {
return 0;
sort(c.begin(), c.end());
if(c.size()==1)return c[0];
ll pl=0;
for(auto i:c)
{
if(i>s)
pl++;
}
if(pl==0)
{
if(c[0]>=t||s<t)
return c[0];
for(int i=0; i<c.size()-1; i++)
{
if(c[i]<=t&&c[i+1]>=t)
return c[i+1];
}
return c[0];
}
else
{
if(c.back()<=t||t<s)
return c.back();
for(int i=0; i<c.size(); i++)
{
if(c[i]>=t)
return c[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... |