제출 #45309

#제출 시각아이디문제언어결과실행 시간메모리
45309imaxblue새로운 문제 (POI13_luk)C++17
0 / 100
279 ms17580 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define x first #define y second #define pii pair<int, int> #define p3i pair<pii, int> #define pll pair<ll, ll> #define p3l pair<pll, ll> #define vi vector<int> #define vpii vector<pii> #define vp3i vector<p3i> #define vpll vector<pll> #define vp3l vector<p3l> #define lseg L, (L+R)/2, N*2+1 #define rseg (L+R)/2+1, R, N*2+2 #define ub upper_bound #define lb lower_bound #define pq priority_queue #define MN 1000000007 #define fox(k, x) for (int k=0; k<x; ++k) #define fox1(k, x) for (int k=1; k<=x; ++k) #define foxr(k, x) for (int k=x-1; k>=0; --k) #define fox1r(k, x) for (int k=x; k>0; --k) #define ms multiset #define flood(x) memset(x, 0x3f3f3f3f, sizeof x) #define drain(x) memset(x, 0, sizeof x) #define rng() ((rand() << 14)+rand()) #define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0) char _; #define pi 3.14159265358979323846 #define siz(x) int(x.size()) int n, x, y, lo, mid, hi=300000, cnt[300005]; vector<int> v[300005]; bool dfs(int N, int D, int P){ fox(l, v[N].size()){ if (v[N][l]==P) continue; dfs(v[N][l], D+1, N); } cnt[D]++; return 1; } int32_t main(){ scanf("%i", &n); fox(l, n-1){ scanf("%i%i", &x, &y); v[x].pb(y); v[y].pb(x); } dfs(1, 0, -1); fox1(l, n) lo=max(lo, cnt[l]); //cout << dfs(1, 0, -1) << endl; cout << lo; return 0; }

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

luk.cpp: In function 'bool dfs(int, int, int)':
luk.cpp:23:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
luk.cpp:39:9:
     fox(l, v[N].size()){
         ~~~~~~~~~~~~~~            
luk.cpp:39:5: note: in expansion of macro 'fox'
     fox(l, v[N].size()){
     ^~~
luk.cpp: In function 'int32_t main()':
luk.cpp:47:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i", &n);
     ~~~~~^~~~~~~~~~
luk.cpp:49:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i%i", &x, &y);
         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...