Submission #167913

#TimeUsernameProblemLanguageResultExecution timeMemory
167913ThuleanxUntitled (POI11_kon)C++14
100 / 100
2227 ms111816 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; int d[n], cnt[n]; for (int i = 0; i < n; i++) cnt[i] = 0; int e = 0; for (int i = 0; i < n; i++) { cin >> d[i]; cnt[d[i]]++; e += d[i]; int x; for (int j = 0; j < d[i]; j++) cin>>x; } sort(d, d+n, greater<int>()); int x = 0, ans = 0; for (int k = 0; k < n-1; k++) { x += d[k]; if (2*x == k*(k+1) + e) { if (d[k] == d[k+1]) ans += cnt[d[k]]; else ans++; } } cout << ans << endl; 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...