# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062417 | Sir_Ahmed_Imran | Simurgh (IOI17_simurgh) | C++17 | 8 ms | 19548 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 <bits/stdc++.h>
#include "simurgh.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 MAXN 200000
int dept[MAXN];
vector<pii> a[MAXN];
vector<int> par[MAXN];
void dfs(int v){
for(auto& i:a[v]){
if(dept[i.ff])
par[v].append(i.ss);
else{
dept[i.ff]=dept[v]+1;
dfs(i.ff);
}
}
}
vector<int> find_roads(int n,vector<int> u,vector<int> v){
pii p;
int m=v.size();
for(int i=0;i<n;i++){
a[v[i]].append({u[i],i});
a[u[i]].append({v[i],i});
}
dept[0]=1;
dfs(0);
vector<int> x;
for(int i=1;i<n;i++)
x.append(par[i][0]);
for(int i=1;i<n;i++){
p={0,0};
for(auto& j:par[i]){
x[i-1]=j;
p=max(p,{count_common_roads(x),j});
}
x[i-1]=p.ss;
}
return x;
}
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... |