Submission #305698

#TimeUsernameProblemLanguageResultExecution timeMemory
305698arthurconmyStations (IOI20_stations)C++14
0 / 100
4 ms624 KiB
#ifndef ARTHUR_LOCAL #include "stations.h" #endif #ifdef ARTHUR_LOCAL #include <bits/stdc++.h> #endif using namespace std; using ll = long long; vector<int> adj[1001]; bool vis[1001]; int curv; int labellist[1001]; void dfs(int v) { vis[v]=1; labellist[v]=++curv; for(auto u:adj[v]) { if(!vis[u]) dfs(u); if(labellist[v]==0) { curv = int(curv/1000); curv++; curv *= 1000; } } } vector<int> label(int n, int k, vector<int> U, 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]); } vector<int> labels(n); for(int i=0; i<n; i++) { if(i==n-1 || adj[i].size()>=3) { curv=-1; dfs(i); break; } } return labels; } int find_next_station(int s, int t, vector<int> C) { if(C.size()==1) return C[0]; if(s==0) { int cur = int(t/1000); cur*=1000; return cur; } if(t==0) { return C[0]; } if(int(s/1000) == int(t/1000)) { if(s<t) return C[1]; else return C[0]; } return C[0]; } #ifdef ARTHUR_LOCAL int main() { cout << "ANS: " << find_next_station(0, 6, {1, 2}) << endl; } #endif
#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...