Submission #124712

#TimeUsernameProblemLanguageResultExecution timeMemory
124712wilwxkNetwork (BOI15_net)C++14
0 / 100
13 ms12152 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN=5e5+5; vector<int> g[MAXN]; int n; int main() { scanf("%d", &n); for(int i=1; i<=n-1; i++) { int a, b; scanf("%d %d", &a, &b); g[a].push_back(b); g[b].push_back(a); } int cont=0; for(int i=1; i<=n; i++) if(g[i].size()==1) cont++; printf("%d\n", (cont+1)/2); }

Compilation message (stderr)

net.cpp: In function 'int main()':
net.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
net.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d %d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...