Submission #805072

#TimeUsernameProblemLanguageResultExecution timeMemory
805072AndreyStations (IOI20_stations)C++14
0 / 100
2111 ms2097152 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; vector<int> yay(0); vector<int> haha[10001]; void dfs(int a, int t, int d) { yay[a] = d; for(int i = 0; i < haha[a].size(); i++) { if(haha[a][i] != t) { dfs(haha[a][i],a,d+1); } } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for(int i = 0; i < n-1; i++) { haha[i].clear(); } for(int i = 0; i < n-1; i++) { haha[u[i]].push_back(v[i]); haha[v[i]].push_back(u[i]); } yay.clear(); for(int i = 0; i < n; i++) { yay.push_back(0); } for(int i = 0; i < n; i++) { if(haha[i].size() == 1) { dfs(i,-1,0); break; } } return yay; } int find_next_station(int s, int t, std::vector<int> c) { if(s > t) { return c[0]; } else { return c[1]; } }

Compilation message (stderr)

stations.cpp: In function 'void dfs(int, int, int)':
stations.cpp:10:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i = 0; i < haha[a].size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~~
#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...