Submission #955076

#TimeUsernameProblemLanguageResultExecution timeMemory
955076Trisanu_DasStations (IOI20_stations)C++17
16 / 100
622 ms1556 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define pb push_back vector<int> adj[1001], col; int lab = 0; void dfs(int s, int p, int lab){ col[s]=lab; for(auto u : adj[s]) if(u!=p) dfs(u,s,lab+1); } vector<int> label(int n, int k, vector<int> a, vector<int> b) { col.resize(n,0); lab = 0; for(int i = 0; i < n; i++) adj[i].clear(); for (int i = 0; i < n-1; i++) adj[a[i]].pb(b[i]), adj[b[i]].pb(a[i]); int ind = 0, x=1; for(int i = 0; i < n; i++) if(adj[i].size()>=3) ind = i; for(auto u : adj[ind]) dfs(u,ind,x*1000),x++; col[ind]=0; return col; } int fi(int x){ return x/1000; } int find_next_station(int s, int t, vector<int> c){ if(c.size()==1 or t==0) return c[0]; if(s==0) for(auto u : c) if(fi(u)==fi(t)) return u; if(fi(s)!=fi(t)) return c[0]; return c[s<t]; }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:19:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   19 |    for(auto u : adj[ind]) dfs(u,ind,x*1000),x++; col[ind]=0; return col;
      |    ^~~
stations.cpp:19:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   19 |    for(auto u : adj[ind]) dfs(u,ind,x*1000),x++; col[ind]=0; return col;
      |                                                  ^~~
#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...