제출 #560142

#제출 시각아이디문제언어결과실행 시간메모리
560142physics07기지국 (IOI20_stations)C++17
0 / 100
805 ms548 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; bool visited[1001]; vector<int> a, adj[1001]; int curr; void dfs(int x=0) { visited[x]=1; a[x]=curr++; for(auto i: adj[x]) if(!visited[i]) dfs(i); } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { curr=0; a.resize(n); memset(visited, 0, sizeof(visited)); for(int i=0; i<1001; i++) adj[i].clear(); for(int i=0; i<n-1; i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(); return a; } int find_next_station(int s, int t, std::vector<int> c) { if(t<=c[0]) return c[0]; return c[upper_bound(c.begin(), c.end(), t)-c.begin()-1]; }
#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...