Submission #1080260

#TimeUsernameProblemLanguageResultExecution timeMemory
1080260Sir_Ahmed_ImranStations (IOI20_stations)C++17
5 / 100
628 ms948 KiB
///~~~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; int e[N]; vector<int> l; vector<int> a[N]; void dfs(int v,int u){ l[v]=m; m++; for(auto& i:a[v]) if(i!=u) dfs(i,v); } vector<int> label(int n,int k,vector<int> u,vector<int> v){ l.clear(); for(int i=m=0;i<n;i++){ a[i].clear(); l.append(0); e[i]=0; } for(int i=0;i<n-1;i++){ a[v[i]].append(u[i]); a[u[i]].append(v[i]); e[v[i]]++; e[u[i]]++; } for(int i=0;i<n;i++){ if(e[i]>1) continue; dfs(i,-1); break; } return(l); } int find_next_station(int s,int t,vector<int> c){ return s-(s>t)+(t>s); }
#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...