Submission #613751

#TimeUsernameProblemLanguageResultExecution timeMemory
613751eNGyStations (IOI20_stations)C++17
52.32 / 100
888 ms776 KiB
#include <bits/stdc++.h> #define con(x) (cerr << __LINE__ << ": " << #x << ' ' << (x) << endl, (x)) #define vis() (cerr << __LINE__ << endl) #define ll long long #define f first #define s second #define pb push_back #define rsz resize #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define mp make_pair using namespace std; void dfs(int n, int p, int &e, vector<int> &L, vector<vector<int>> &G){ L[n] = (1e3 * e); for(int v: G[n]){ if(v != p){ e++; dfs(v, n, e, L, G); } } L[n] += e; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){ vector<vector<int>> G(n); for(int i=0; i<n-1; i++){ G[u[i]].pb(v[i]); G[v[i]].pb(u[i]); } vector<int> L(n); int e = 0; dfs(0, -1, e, L, G); return L; } int find_next_station(int s, int t, std::vector<int> c){ int a_s = s/1000, b_s = s%1000; int a_t = t/1000, b_t = t%1000; if(a_s <= a_t && b_t <= b_s){ for(int f: c){ if(f < s) continue; int a_f = f/1000, b_f = f%1000; if(a_f <= a_t && b_t <= b_f) return f; } }else{ return c[0]; } }

Compilation message (stderr)

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