Submission #1088815

# Submission time Handle Problem Language Result Execution time Memory
1088815 2024-09-15T07:08:22 Z Bismillah Conspiracy (POI11_kon) C++17
0 / 100
3000 ms 107520 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 (ans) while(1);
            if(deg[i] == deg[i - 1]) ans += cnt[deg[i]];
            else ans++;
        }
    }
    cout << ans;
    return 0;
}

Compilation message

kon.cpp: In function 'int main()':
kon.cpp:23:20: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   23 |           if (ans) while(1);
      |                    ^~~~~
kon.cpp:24:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   24 |             if(deg[i] == deg[i - 1]) ans += cnt[deg[i]];
      |             ^~
# 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 Correct 0 ms 604 KB Output is correct
4 Execution timed out 3091 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 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 476 KB Output is correct
3 Execution timed out 3021 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 580 KB Output is correct
3 Execution timed out 3025 ms 344 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Execution timed out 3036 ms 2644 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 856 KB Output is correct
2 Execution timed out 3046 ms 3452 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 2640 KB Output is correct
2 Execution timed out 3094 ms 7276 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 4176 KB Output is correct
2 Execution timed out 3056 ms 15840 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 461 ms 36252 KB Output is correct
2 Correct 292 ms 23892 KB Output is correct
3 Execution timed out 3014 ms 107520 KB Time limit exceeded
4 Halted 0 ms 0 KB -