Submission #614061

#TimeUsernameProblemLanguageResultExecution timeMemory
614061Dan4LifeStations (IOI20_stations)C++17
0 / 100
888 ms524 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; int x = 0; for(auto u : adj[s]) if(u!=p) dfs(u,s,lab*10+x),x++; } vector<int> label(int n, int k, vector<int> a, vector<int> b) { col.clear(), 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]); dfs(0,-1,1); return col; } int is_anc(int s, int t){ while(t/10>s) t/=10; return s==t; } int find_next_station(int s, int t, vector<int> c){ if(c.size()==1) return c[0]; for(auto u : c) if(is_anc(u,t)) return u; return s/10; }

Compilation message (stderr)

stations.cpp: In function 'int is_anc(int, int)':
stations.cpp:23:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   23 |   while(t/10>s) t/=10; return s==t;
      |   ^~~~~
stations.cpp:23:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   23 |   while(t/10>s) t/=10; return s==t;
      |                        ^~~~~~
#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...