Submission #589429

#TimeUsernameProblemLanguageResultExecution timeMemory
589429fuad27Stations (IOI20_stations)C++17
0 / 100
1576 ms2097152 KiB
#include "stations.h" #include <vector> #include<bits/stdc++.h> using namespace std; #define pb push_back const int N = 1010; typedef long long ll; vector<int> g[N]; vector<int> tin, tout; int cnt=0; void dfs(int at, int p) { tin[at]=cnt++; for(int to:g[at]) { if(to != p)dfs(to, at); } tout[at]=cnt++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { tin.resize(n); tout.resize(n); for(int i = 0;i<n;i++) { g[u[i]].pb(v[i]); g[v[i]].pb(u[i]); } dfs(0, 0); vector<int> l(n); for(int i = 0;i<n;i++) { l[i]=(2*1000-1)*tin[i]+tout[i]; } return l; } int find_next_station(int s, int t, std::vector<int> c) { if((s%(2000-1)) >= t%(2000-1) and s/(2000-1) <= t/(2000-1)) { for(int i=0;i<(int)c.size();i++) { if((c[i]%(2000-1)) >= t%(2000-1) and c[i]/(2000-1) <= t/(2000-1))return c[i]; } } else { for(int i = 0;i<(int)c.size();i++) { if(s%(2000-1) <= c[i]%(2000-1) and s/(2000-1) <= c[i]/(2000-1)) { return c[i]; } } } }

Compilation message (stderr)

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