Submission #77107

#TimeUsernameProblemLanguageResultExecution timeMemory
77107thebesTriumphal arch (POI13_luk)C++14
0 / 100
287 ms30920 KiB
#include <bits/stdc++.h> using namespace std; const int MN = 3e5+5; int vis[MN], N, i, x, y, ans; vector<int> adj[MN]; queue<int> q; void rec(){ int sz = q.size(); while(sz --){ int c=q.front(); q.pop(); for(auto v : adj[c]){ if(!vis[v]){ vis[v] = 1; q.push(v); } } } ans = max(ans, (int)q.size()); if(q.size()) rec(); } int main(){ for(scanf("%d",&N),i=1;i<N;i++){ scanf("%d%d",&x,&y); adj[x].push_back(y); adj[y].push_back(x); } q.push(1); vis[1]=1; rec(); printf("%d\n",ans); return 0; }

Compilation message (stderr)

luk.cpp: In function 'int main()':
luk.cpp:23:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(scanf("%d",&N),i=1;i<N;i++){
      ~~~~~~~~~~~~~~^~~~
luk.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&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...