이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
www.youtube.com/YugiHackerChannel
oj.vnoi.info/user/YugiHackerKhongCopCode
*/
#include<bits/stdc++.h>
#define el cout<<"\n"
#define f0(i,n) for(int i=0;i<n;++i)
#define f1(i,n) for(int i=1;i<=n;++i)
#define maxn 352
#define MOD 1000000007
using namespace std;
int n;
long long f[maxn][maxn][2];
//f[i][n][ok]: chon den nguoi thu i, da su dung n tasks, ok: da co nguoi thoa man chua
long long c[maxn][maxn];
long long C(int n, int k)
{
if (n == k || k == 0) return 1;
if (k>n) return 0;
if (c[n][k] != -1) return c[n][k];
return c[n][k] = (C(n-1, k) + C(n-1, k-1)) % MOD;
}
main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
memset(c, -1, sizeof c);
cin >> n;
f[0][0][0] = 1;
for (int i=1; i<=n; i++)
{
for (int x=0; x<=n; x++)
{
for (int j=0; j<=x; j++)
{
if(j!=i) (f[i][x][0] += C(n-x+j, j) * f[i-1][x-j][0] % MOD) %= MOD;
else (f[i][x][1] += C(n-x+j, j) * f[i-1][x-j][0] % MOD) %= MOD;
(f[i][x][1] += C(n-x+j, j) * f[i-1][x-j][1] % MOD) %= MOD;
}
}
}
cout << f[n][n][1];
}
컴파일 시 표준 에러 (stderr) 메시지
zapina.cpp:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
23 | main()
| ^~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |