Submission #772591

#TimeUsernameProblemLanguageResultExecution timeMemory
772591khshgStations (IOI20_stations)C++14
0 / 100
748 ms504 KiB
#include"stations.h" #include<bits/stdc++.h> using namespace std; vector<vector<int>> adj; vector<int> label(int N, int K, vector<int> u, vector<int> v) { vector<int> labels(N); iota(begin(labels), end(labels), 0); return labels; } int find_next_station(int s, int t, vector<int> c) { vector<int> S, T; int start = s, target = t; while(s > 0) { S.push_back(s); s >>= 1; } while(t > 0) { T.push_back(t); t >>= 1; } int LCA = -1; while((int)S.size() && (int)T.size() && S.back() == T.back()) { LCA = S.back(); S.pop_back(); T.pop_back(); } if(LCA == start) { return S.back(); } return LCA / 2; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:14:17: warning: unused variable 'target' [-Wunused-variable]
   14 |  int start = s, target = t;
      |                 ^~~~~~
#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...