제출 #49589

#제출 시각아이디문제언어결과실행 시간메모리
49589rzbtNetwork (BOI15_net)C++14
0 / 100
3 ms820 KiB
#include <bits/stdc++.h> using namespace std; int n; int niz[500005]; vector<int> listovi; int main() { scanf("%d", &n); for(int i=1;i<n;i++){ int t1,t2; scanf("%d %d", &t1, &t2); niz[t1]++; niz[t2]++; } for(int i=1;i<=n;i++){ if(niz[i]==1)listovi.push_back(i); } if(listovi.size()%2==1)listovi.push_back(listovi.front()); printf("%d\n",listovi.size()/2); for(int i=0;i<listovi.size();i+=2) printf("%d %d\n",listovi[i],listovi[i+1]); return 0; }

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

net.cpp: In function 'int main()':
net.cpp:20:35: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n",listovi.size()/2);
                   ~~~~~~~~~~~~~~~~^
net.cpp:21:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<listovi.size();i+=2)
                 ~^~~~~~~~~~~~~~~
net.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
net.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &t1, &t2);
         ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...