Submission #605551

#TimeUsernameProblemLanguageResultExecution timeMemory
605551MohamedAliSaidaneStations (IOI20_stations)C++14
0 / 100
1 ms320 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; #define pb push_back #define popb pop_back #define all(x) (x).begin(),(x).end() #define ff first #define ss second const int nax = 1001; vi rep; int cureul = -1; vi adj[nax]; void dfs(int x, int p = -1) { rep[x]= ++cureul; for(auto e: adj[x]) if(e != p) dfs(e, x); rep[x] += 1000 * cureul; } vi label(int n, int k, vi u, vi v) { rep.assign(n + 1, - 1); for(int i= 0; i < n - 1; i ++) { adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } dfs(0); return rep; } int find_next_station(int s, int t, vi c) { int tin = s%1000; int tout = s/1000; int innt = t%1000; int outt = t/1000; if(innt >= tin && innt <= tout) { for(auto e: c) { int u = e/1000; int v = e%1000; if(innt >= v && innt <= u) return e; } } else { int mini = c[0]; for(auto e: c) { int u = e%1000; if(u < mini%1000) mini = u; } return mini; } }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, vi)':
stations.cpp:49:13: warning: unused variable 'outt' [-Wunused-variable]
   49 |         int outt = t/1000;
      |             ^~~~
stations.cpp:71:5: warning: control reaches end of non-void function [-Wreturn-type]
   71 |     }
      |     ^
#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...