답안 #605222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
605222 2022-07-25T14:13:21 Z 1bin Conspiracy (POI11_kon) C++14
100 / 100
1527 ms 117180 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(deg[i] == deg[i - 1]) ans += cnt[deg[i]];
            else ans++;
        }
    }
    cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 232 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 596 KB Output is correct
2 Correct 38 ms 2872 KB Output is correct
3 Correct 185 ms 13388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 724 KB Output is correct
2 Correct 59 ms 4152 KB Output is correct
3 Correct 242 ms 18000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 3000 KB Output is correct
2 Correct 121 ms 9032 KB Output is correct
3 Correct 405 ms 29556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 5052 KB Output is correct
2 Correct 269 ms 20844 KB Output is correct
3 Correct 884 ms 69408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 628 ms 47828 KB Output is correct
2 Correct 386 ms 31084 KB Output is correct
3 Correct 1380 ms 107580 KB Output is correct
4 Correct 1527 ms 117180 KB Output is correct
5 Correct 1 ms 340 KB Output is correct