제출 #151206

#제출 시각아이디문제언어결과실행 시간메모리
151206cfalasNetwork (BOI15_net)C++14
0 / 100
2 ms380 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; vector<int> ans; cin>>n; int a[n+1] = {}; for(int i=0;i<=n;i++) a[i]=0; for(int i=0;i<n-1;i++){ int b, c; cin>>b>>c; a[b]++; a[c]++; } for(int i=1;i<=n;i++){ if(a[i]<2) ans.push_back(i); } cout<<(ans.size()+1)/2<<endl; for(int i=0;i<ans.size();i+=2){ if(i<ans.size()-1) cout<<ans[i]<<" "<<ans[i+1]<<endl; else cout<<ans[0]<<" "<<ans[i]<<endl; } }

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

net.cpp: In function 'int main()':
net.cpp:20:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<ans.size();i+=2){
              ~^~~~~~~~~~~
net.cpp:21:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i<ans.size()-1) cout<<ans[i]<<" "<<ans[i+1]<<endl;
      ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...