Submission #403160

#TimeUsernameProblemLanguageResultExecution timeMemory
403160AmineTrabelsiStations (IOI20_stations)C++14
5 / 100
1126 ms620 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; const int Mx = 1010; void dfs(int node,int par,vector<int> &labels,vector<vector<int>> &tr){ for(auto i:tr[node]){ if(i != par){ labels[i] = labels[node]+1; dfs(i,node,labels,tr); } } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n); vector<vector<int>> tr(n+1,vector<int>(0)); for (int i = 0; i < n-1; i++) { tr[u[i]].push_back(v[i]); tr[v[i]].push_back(u[i]); } int root = 0; for(int i=0;i<n;i++){ if(tr[i].size() == 1){ root = i; break; } } dfs(root,-1,labels,tr); return labels; } int find_next_station(int s, int t, vector<int> c) { if(t <= s) return *min_element(c.begin(),c.end()); return *max_element(c.begin(),c.end()); }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:31:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   31 |     if(t <= s)
      |     ^~
stations.cpp:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   33 |  return *max_element(c.begin(),c.end());
      |  ^~~~~~
#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...