Submission #80883

#TimeUsernameProblemLanguageResultExecution timeMemory
80883farukkastamonudaUntitled (POI11_kon)C++14
80 / 100
1833 ms132096 KiB
#include <bits/stdc++.h> #define fi first #define se second #define lo long long #define inf 1000000000 #define md 1000000007 #define li 5005 #define mp make_pair #define pb push_back using namespace std; int n, deg, x, gg[li], tut[li], topla, cev, edge; int main(){ scanf("%d", &n); for(int i = 1; i <= n; i ++){ scanf("%d", &deg); for(int j =1 ;j <= deg; j ++){ scanf("%d", &x); } topla += deg; gg[deg] ++; } edge = topla / 2; int last = 0; for(int i = n - 1; i >= 0; i --){ for(int j = gg[i]; j >= 1 ; j --){ tut[last ++] = i; } } int sum = 0; for(int i = 0; i< n - 1; i ++){ sum = sum + tut[i] - i; if(sum == edge){ if(tut[i] == tut[i+1]){ cev += gg[tut[i]]; } else cev += 1; } } printf("%d\n", cev); return 0; }

Compilation message (stderr)

kon.cpp: In function 'int main()':
kon.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
kon.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &deg);
   ~~~~~^~~~~~~~~~~~
kon.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &x);
    ~~~~~^~~~~~~~~~
#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...