Submission #1088816

# Submission time Handle Problem Language Result Execution time Memory
1088816 2024-09-15T07:23:11 Z Bismillah Conspiracy (POI11_kon) C++17
10 / 100
3000 ms 107348 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)){
          	if(i < n-1 && deg[i] == deg[i+1] && deg[i] == deg[i-1]) while (1);
            if(deg[i] == deg[i - 1]) ans += cnt[deg[i]];
            else ans++;
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 3075 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 3089 ms 348 KB Time limit exceeded
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 Execution timed out 3061 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Execution timed out 3044 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 600 KB Output is correct
2 Execution timed out 3090 ms 2896 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 860 KB Output is correct
2 Execution timed out 3082 ms 4024 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 3012 KB Output is correct
2 Execution timed out 3089 ms 9144 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 5204 KB Output is correct
2 Execution timed out 3049 ms 20784 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 486 ms 47684 KB Output is correct
2 Correct 285 ms 31056 KB Output is correct
3 Execution timed out 3054 ms 107348 KB Time limit exceeded
4 Halted 0 ms 0 KB -