Submission #1062417

#TimeUsernameProblemLanguageResultExecution timeMemory
1062417Sir_Ahmed_ImranSimurgh (IOI17_simurgh)C++17
0 / 100
8 ms19548 KiB
///~~~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)

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:33:9: warning: unused variable 'm' [-Wunused-variable]
   33 |     int m=v.size();
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...