Submission #307796

#TimeUsernameProblemLanguageResultExecution timeMemory
307796VimmerStations (IOI20_stations)C++14
5 / 100
981 ms5876 KiB
#include <bits/stdc++.h> #include "stations.h" //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define N 100005 #define PB push_back #define sz(x) int(x.size()) #define F first #define M ll(1e9 + 7) #define S second #define all(x) x.begin(), x.end() #define endl '\n' //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("-O3") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("fast-math") //#pragma GCC optimize("no-stack-protector") using namespace std; //using namespace __gnu_pbds; typedef long long ll; //typedef tree <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; ll mlt(ll x, ll y) {return (x * y) % M;} ll sm(ll x, ll y) {return (x + y) % M;} vector <int> g[N], a; int id = 0; void dfs(int v, int p) { a[v] = id++; for (auto it : g[v]) { if (it == p) continue; dfs(it, v); } } void rec(int v, int p) { for (auto it : g[v]) { if (it == p) continue; rec(it, v); } a[v] = id++; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { a.resize(n); id = 0; for (int i = 0; i < n - 1; i++) { g[u[i]].PB(v[i]); g[v[i]].PB(u[i]); } bool f = 1; for (int i = 0; i < n; i++) if (sz(g[i]) > 2) f = 0; if (f) { for (int i = 0; i < n; i++) if (sz(g[i]) == 1) {dfs(i, -1); break;} } else rec(0, -1); for (int i = 0; i < n; i++) g[i].clear(); return a; } int find_next_station(int s, int t, vector<int> c) { if (sz(c) == 1) return c[0]; if (sz(c) == 2) { sort(all(c)); if (t < c[1]) return c[0]; return c[1]; } if (sz(c) == 3) { sort(all(c)); if (t < c[0]) return c[2]; if (t < c[1]) return c[0]; if (t < c[2]) return c[1]; return c[2]; } } //int main() //{ // iostream::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // // //freopen("fcolor.in", "r", stdin); freopen("fcolor.out", "w", stdout); // // //}

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:113:1: warning: control reaches end of non-void function [-Wreturn-type]
  113 | }
      | ^
#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...