Submission #124712

# Submission time Handle Problem Language Result Execution time Memory
124712 2019-07-03T18:30:36 Z wilwxk Network (BOI15_net) C++14
0 / 100
13 ms 12152 KB
#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

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 time Memory Grader output
1 Incorrect 13 ms 12152 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 12152 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 12152 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -