# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080166 | Sir_Ahmed_Imran | Stations (IOI20_stations) | C++17 | 657 ms | 1272 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.
///~~~LOTA~~~///
//#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 1000
int m;
vector<int> l;
vector<int> a[N];
void dfs(int v,int u){
int r=1e9;
for(auto& i:a[v]){
if(i==u) continue;
dfs(i,v);
r=min(r,l[i]/1000);
}
l[v]=min(r,m)*1000+m;
m++;
}
vector<int> label(int n,int k,vector<int> u,vector<int> v){
l.clear();
for(int i=0;i<n;i++){
a[i].clear();
l.append(0);
}
for(int i=m=0;i<n-1;i++){
a[u[i]].append(v[i]);
a[v[i]].append(u[i]);
}
dfs(0,-1);
return l;
}
int find_next_station(int s,int t,vector<int> c){
int l,r,p,q,x,y,z;
l=s/1000;r=s%1000;
p=t/1000;q=t%1000;
for(auto& i:c){
x=i/1000;
y=i%1000;
if(x<=l && r<=y) z=i;
if(l<=x && y<=r && x<=p && q<=y)
return i;
}
return z;
}
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... |