제출 #731085

#제출 시각아이디문제언어결과실행 시간메모리
731085Ivo_12Torrent (COI16_torrent)C++17
0 / 100
232 ms36624 KiB
#include <bits/stdc++.h> using namespace std; int n, a, b, x, y; vector < int > connections[300010]; vector < int > trail; bool find_trail( int prev, int cur ) { if(cur == b) { trail.push_back(cur); return 1; } for(int i = 0; i < connections[cur].size(); i++) { if(connections[cur][i] != prev) { if(find_trail(cur, connections[cur][i])) { trail.push_back(cur); return 1; } } } } int main( void ) { cin >> n >> a >> b; for(int i = 0; i < n-1; i++) { cin >> x >> y; connections[x].push_back(y); connections[y].push_back(x); } find_trail(-1, a); for(int i = 0; i < trail.size(); i++) { cout << trail[i] << " "; } return 0; }

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

torrent.cpp: In function 'bool find_trail(int, int)':
torrent.cpp:14:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i = 0; i < connections[cur].size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~~~~~~~~~~
torrent.cpp: In function 'int main()':
torrent.cpp:33:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  for(int i = 0; i < trail.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~
torrent.cpp: In function 'bool find_trail(int, int)':
torrent.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...