Submission #1088819

# Submission time Handle Problem Language Result Execution time Memory
1088819 2024-09-15T08:02:32 Z Bismillah Conspiracy (POI11_kon) C++17
10 / 100
3000 ms 107200 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;
  	vector<int> counter(n+2, 0);
    for(int i = n - 1; i; i--){
        a += deg[i]; b -= deg[i]; x++;
        if(a - b == x * (x - 1)){
          	++counter[deg[i]];
          	if (counter[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 348 KB Output is correct
2 Execution timed out 3089 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Execution timed out 3093 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 2 ms 604 KB Output is correct
3 Execution timed out 3086 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Execution timed out 3081 ms 3020 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 3090 ms 4180 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 3156 KB Output is correct
2 Execution timed out 3044 ms 9144 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 43 ms 5176 KB Output is correct
2 Execution timed out 3057 ms 20812 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 465 ms 47808 KB Output is correct
2 Correct 323 ms 31064 KB Output is correct
3 Execution timed out 3026 ms 107200 KB Time limit exceeded
4 Halted 0 ms 0 KB -