답안 #28964

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28964 2017-07-18T02:12:33 Z 윤교준(#1230) Triumphal arch (POI13_luk) C++11
0 / 100
303 ms 20124 KB
#include <bits/stdc++.h>
#define pb push_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define revv(V) reverse(allv(V))
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
#define MAXN (300005)
using namespace std;
typedef long long ll;
void fg(vector<int> G[], int a, int b) { G[a].pb(b); G[b].pb(a); }

vector<int> G[MAXN];
int cnt[MAXN];
int N;

void f(int idx) {
	cnt[idx] = 1;
	for(int v : G[idx]) if(!cnt[v]) { f(v); cnt[idx]++; }
}
int main() {
	scanf("%d", &N);
	for(int i = 1, a, b; i < N; i++) {
		scanf("%d%d", &a, &b);
		fg(G, a, b);
	}
	f(1);
	printf("%d\n", (*max_element(cnt+1, cnt+N+1)) - 1);
	return 0;
}

Compilation message

luk.cpp: In function 'int main()':
luk.cpp:28:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
luk.cpp:30:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &a, &b);
                        ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 10224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 10224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 10224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 10224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 10620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 11280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 69 ms 13524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 179 ms 16824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 296 ms 20124 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 303 ms 20124 KB Output isn't correct
2 Halted 0 ms 0 KB -