# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
208605 | 2020-03-11T19:18:20 Z | MKopchev | Conspiracy (POI11_kon) | C++14 | 2083 ms | 2680 KB |
#include<bits/stdc++.h> using namespace std; const int nmax=5000+42; int n; int deg[nmax]; bool cmp(int a,int b) { return a>b; } long long comb(int s,int t) { t=min(t,s-t); long long ret=1; for(int i=1;i<=t;i++) ret=ret*(s+1-i)/i; return ret; } int main() { ios_base::sync_with_stdio(false); cin.tie(); cin>>n; for(int i=1;i<=n;i++) { int SZ,to; cin>>deg[i]; for(int j=1;j<=deg[i];j++) { cin>>to; } } sort(deg+1,deg+n+1,cmp); long long output=0; for(int k=1;k<n;k++) { int sum_left=0,sum_right=k*(k-1); for(int j=1;j<=k;j++)sum_left+=deg[j]; for(int j=k+1;j<=n;j++)sum_right+=deg[j]; if(sum_left==sum_right) { int eq=0,eq_taken=0; for(int j=1;j<=k;j++) if(deg[j]==deg[k])eq_taken++; for(int j=1;j<=n;j++) if(deg[j]==deg[k])eq++; output=output+comb(eq,eq_taken); } } cout<<output<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 504 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 7 ms | 468 KB | Output is correct |
3 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 504 KB | Output is correct |
2 | Correct | 8 ms | 504 KB | Output is correct |
3 | Correct | 8 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 632 KB | Output is correct |
2 | Correct | 61 ms | 2168 KB | Output is correct |
3 | Correct | 241 ms | 2168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 760 KB | Output is correct |
2 | Correct | 88 ms | 2164 KB | Output is correct |
3 | Correct | 336 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 59 ms | 2172 KB | Output is correct |
2 | Correct | 178 ms | 2184 KB | Output is correct |
3 | Correct | 538 ms | 536 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 99 ms | 2168 KB | Output is correct |
2 | Correct | 391 ms | 504 KB | Output is correct |
3 | Correct | 1171 ms | 760 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 829 ms | 504 KB | Output is correct |
2 | Correct | 524 ms | 376 KB | Output is correct |
3 | Correct | 1934 ms | 608 KB | Output is correct |
4 | Correct | 2083 ms | 2680 KB | Output is correct |
5 | Correct | 20 ms | 504 KB | Output is correct |