Submission #605222

#TimeUsernameProblemLanguageResultExecution timeMemory
6052221binUntitled (POI11_kon)C++14
100 / 100
1527 ms117180 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 1e5 + 5; int n, deg[NMAX], cnt[NMAX], ans, x, a, b; int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 0; i < n; i++){ cin >> deg[i]; cnt[deg[i]]++; b += deg[i]; for(int j = 0; j < deg[i]; j++) cin >> x; } sort(deg, deg + n); x = 0; for(int i = n - 1; i; i--){ a += deg[i]; b -= deg[i]; x++; if(a - b == x * (x - 1)){ if(deg[i] == deg[i - 1]) ans += cnt[deg[i]]; else ans++; } } cout << ans; return 0; }
#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...