Submission #1088814

# Submission time Handle Problem Language Result Execution time Memory
1088814 2024-09-15T07:06:36 Z Bismillah Conspiracy (POI11_kon) C++17
0 / 100
462 ms 47868 KB
#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)){
             ans += cnt[deg[i]];
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 480 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 732 KB Output is correct
2 Incorrect 30 ms 3012 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 860 KB Output is correct
2 Incorrect 38 ms 4028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 3148 KB Output is correct
2 Incorrect 93 ms 9040 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 5200 KB Output is correct
2 Incorrect 195 ms 20932 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 462 ms 47868 KB Output is correct
2 Incorrect 291 ms 31168 KB Output isn't correct
3 Halted 0 ms 0 KB -