Submission #605579

#TimeUsernameProblemLanguageResultExecution timeMemory
605579MohamedAliSaidaneStations (IOI20_stations)C++14
52.32 / 100
1190 ms776 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) { for(int i = 0 ; i < n; i++) adj[i].clear(); cureul = -1; rep.assign(n , 0); 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 && v > tin) return e; } } else { for(auto e: c) { if(e%1000 < tin) return e; } } }

Compilation message (stderr)

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