# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
208603 | MKopchev | Untitled (POI11_kon) | C++14 | 3033 ms | 115384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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()
{
scanf("%i",&n);
for(int i=1;i<=n;i++)
{
int SZ,to;
scanf("%i",°[i]);
for(int j=1;j<=deg[i];j++)
{
scanf("%i",&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);
}
}
printf("%lld\n",output);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |