# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
460862 | kingfran1907 | Calvinball championship (CEOI15_teams) | C++14 | 99 ms | 65540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long llint;
const int maxn = 1e4+2;
const int base = 31337;
const int mod = 1e6+7;
const int inf = 0x3f3f3f3f;
const int logo = 18;
const int off = 1 << logo;
const int treesiz = off << 1;
int n;
int niz[maxn];
int dp[maxn][maxn];
int mul(int a, int b) {
llint out = (llint) a * b;
return out % mod;
}
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", niz+i);
}
for (int i = 1; i <= n; i++) dp[0][i] = 1;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dp[i][j] = (dp[i - 1][j + 1] + mul(j, dp[i - 1][j])) % mod;
int sol = 0;
int maxi = niz[0];
for (int i = 1; i < n; i++)
sol += mul(niz[i] - 1, dp[n - i - 1][maxi]), sol %= mod, maxi = max(maxi, niz[i]);
printf("%d\n", sol + 1);
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... |