제출 #696731

#제출 시각아이디문제언어결과실행 시간메모리
696731garam1732기지국 (IOI20_stations)C++14
8 / 100
942 ms544 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[1010]; std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { std::vector<int> labels(n); for(int i = 0; i < n; i++) adj[i].clear(); for(int i = 0; i < u.size(); i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } for(int i = 0; i < n; i++) labels[i] = i; return labels; } int lca(int s, int t) { vector<bool> chk(1010); for(int here = s; here; here >>= 1) chk[here] = 1; for(int here = t; here; here >>= 1) { if(chk[here]) return here; } } int find_next_station(int s, int t, std::vector<int> c) { s++; t++; int a = lca(s, t); if(a != s) return s/2-1; while(t/2 != s) t >>= 1; return t-1; }

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:11:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |  for(int i = 0; i < u.size(); i++) {
      |                 ~~^~~~~~~~~~
stations.cpp: In function 'int lca(int, int)':
stations.cpp:21:26: warning: control reaches end of non-void function [-Wreturn-type]
   21 |     vector<bool> chk(1010);
      |                          ^
#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...