제출 #463670

#제출 시각아이디문제언어결과실행 시간메모리
463670tomsyd통행료 (IOI18_highway)C++17
0 / 100
279 ms262148 KiB
#include "highway.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> adj; vector<int> nodes; void dfs(int node, int prev){ for (int i:adj[node]){ if (i != prev){ dfs(i,node); } } nodes.emplace_back(node); } void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { int M = U.size(); nodes.clear(); adj = vector<vector<int>>(N); for (int i=0; i<M; ++i){ adj[U[i]].emplace_back(V[i]); adj[V[i]].emplace_back(U[i]); } dfs(0,-1); vector<int> query; for (int i=0; i<N; ++i) query.emplace_back(1); int init = ask(query), crt = nodes[nodes.size()-1]; for (int j=0; j<nodes.size()-1; ++j){ query[nodes[j]] = 0; if (ask(query) != init){ crt = nodes[j]; break; } query[nodes[j]] = 1; } cout << crt; }

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

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:29:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for (int j=0; j<nodes.size()-1; ++j){
      |                ~^~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...