Submission #609677

#TimeUsernameProblemLanguageResultExecution timeMemory
609677dariaStations (IOI20_stations)C++17
0 / 100
944 ms464 KiB
#include"bits/stdc++.h" #include "stations.h" #include <vector> using namespace std; #define ll int const ll N = 1000; ll t = 0; vector<ll> adj[N], lb(N, -1); void dfs(ll s){ if(lb[s]>=0) return; lb[s] = t++; for(auto u : adj[s]) dfs(u); lb[s] += 2*N*(t++); } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { for(ll i=0; i<n-1; ++i){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0); vector<int> r(n); for(ll i=0; i<n; ++i) r[i] = lb[i]; return r; } int find_next_station(int s, int t, std::vector<int> c) { ll x1 = s%(2*N); ll y1 = s/(2*N); ll x2 = t%(2*N); ll y2 = t/(2*N); //tempi di entrata e uscita dei target if(x1 > y2 || y1 < x2){ for(auto u : c){ ll x3 = u%(2*N); ll y3 = u/(2*N); if(x3 < x1 && y1 < x3) return u; } } for(auto u : c){ ll x3 = u%(2*N); ll y3 = u/(2*N); if(x3 <= x2 && y2 <= x3) return u; } return c[0]; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:37:24: warning: unused variable 'y3' [-Wunused-variable]
   37 |    ll x3 = u%(2*N); ll y3 = u/(2*N);
      |                        ^~
stations.cpp:42:23: warning: unused variable 'y3' [-Wunused-variable]
   42 |   ll x3 = u%(2*N); ll y3 = u/(2*N);
      |                       ^~
#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...