제출 #609702

#제출 시각아이디문제언어결과실행 시간메모리
609702daria기지국 (IOI20_stations)C++14
0 / 100
3 ms456 KiB
#include"bits/stdc++.h" #include "stations.h" #include <vector> using namespace std; const int N = 1000; int T = 0; vector<int> adj[N], lb(N, -1); void dfs(int s){ if(lb[s]==-1) return; lb[s] = T++; for(auto u : adj[s]) dfs(u); lb[s] += N*T; } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { for(int i=0; i<n-1; ++i){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0); lb.resize(n); return lb; } int find_next_station(int s, int t, std::vector<int> c) { int x1 = s%(2*N); int y1 = s/(2*N); int x2 = t%(2*N); int y2 = t/(2*N); //tempi di entrata e uscita dei target for(auto u : c){ int x3 = u%(2*N); int y3 = u/(2*N); if(x3 <= x2 && y2 <= y3) return u; } if(x1 >= y2 || y1 <= x2){ for(auto u : c){ int x3 = u%(2*N); int y3 = u/(2*N); if(x3 < x1 && y1 < y3) return u; } } return c[0]; }
#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...