Submission #427989

#TimeUsernameProblemLanguageResultExecution timeMemory
427989AmylopectinIsland (NOI18_island)C++14
100 / 100
195 ms31236 KiB
#include <iostream> #include <stdio.h> #include <vector> using namespace std; const int mxn = 8e5 + 10; vector <int> pa[mxn] = {}; int ans[mxn] = {}; int fima(int l,int r) { if(l > r) return l; return r; } int main() { int i,j,n,m,f,t,ma = 0; scanf("%d %d",&n,&m); for(i=0; i<n+m-1; i++) { scanf("%d %d",&f,&t); pa[f].push_back(t); pa[t].push_back(f); } for(i=n+1; i<=n+m; i++) { ans[pa[i].size()-1] ++; ma = fima(ma,pa[i].size()-1); } for(i=ma; i>1; i--) { ans[i] += ans[i+1]; } for(i=2; i<=ma; i++) { printf("%d %d\n",i,ans[i]); } return 0; }

Compilation message (stderr)

island.cpp: In function 'int main()':
island.cpp:16:11: warning: unused variable 'j' [-Wunused-variable]
   16 |     int i,j,n,m,f,t,ma = 0;
      |           ^
island.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%d %d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~
island.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d %d",&f,&t);
      |         ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...