Submission #468366

#TimeUsernameProblemLanguageResultExecution timeMemory
468366kessidoStations (IOI20_stations)C++17
0 / 100
1087 ms528 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define ll long long int #define vll vector<ll> #define vi vector<int> #define vvi vector<vi> #define pi pair<int, int> #define pll pair<ll, ll> #define all(x) (x).begin(), (x).end() #define fori(i,n) for(int i = 0; i < int(n); ++i) vi label(int n, int k, vi u, vi v) { vvi e(n); fori(i,n-1){ e[u[i]].push_back(v[i]); e[v[i]].push_back(u[i]); } int cur_label = 0; vi res(n, -1); auto dfs = [&](auto& self, int i, int parent) -> void { res[i] = cur_label++; for(int j : e[i]) { if(j==parent) continue; self(self, j, i); } }; dfs(dfs, 0, -1); assert(cur_label==n); return res; } int find_next_station(int s, int t, vi c) { sort(all(c)); if(t < s) return c[0]; // parent; int i = 1; while(i < c.size() && c[i] >= t) i++; return c[i-1]; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:38:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     while(i < c.size() && c[i] >= t) 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...