Submission #1018184

#TimeUsernameProblemLanguageResultExecution timeMemory
1018184BoasStations (IOI20_stations)C++17
8 / 100
2304 ms1188 KiB
#include <bits/stdc++.h> using namespace std; #include "stations.h" #define loop(x, i) for (int i = 0; i < x; i++) #define pb push_back #define ALL(x) (x).begin(), (x).end() typedef vector<int> vi; typedef pair<int, int> ii; typedef set<int> si; typedef vector<vi> vvi; vi label(int n, int k, vi u, vi v) { vi labels(n); for (int i = 0; i < n; i++) { labels[i] = i; } return labels; } int DFS(int i, int t, vvi &adj, int prev = -1) { for (int j : adj[i]) { if (j == prev) continue; if (j == t) return j; int ans = DFS(j, t, adj, i); if (ans != -1) return j; } return -1; } int find_next_station(int s, int t, vi c) { // if (t < s) return c[0]; // int layer = 0; int n = max(s, t) + 1; // int n = 1000; vvi adj(n); loop(n - 1, i) { adj[i + 1].pb(i / 2); adj[i / 2].pb(i + 1); } return DFS(s, t, adj); }
#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...