| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1053614 | VMaksimoski008 | Calvinball championship (CEOI15_teams) | C++17 | 415 ms | 856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e6 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
int dp[2][10005][2];
signed main() {
int n;
cin >> n;
vector<int> v(n+1);
for(int i=1; i<=n; i++) cin >> v[i];
dp[0][1][0] = 1;
for(int a=1; a<n; a++) {
for(int b=1; b<=a; b++) {
for(int c=0; c<2; c++) {
if(c) {
dp[1][b][1] = (dp[1][b][1] + b * dp[0][b][1]) % mod;
dp[1][b+1][1] = (dp[1][b+1][1] + dp[0][b][1]) % mod;
continue;
}
int mx = min(b+1, v[a+1]);
if(v[a+1] <= b) dp[1][b][0] = (dp[1][b][0] + dp[0][b][0]) % mod;
if(v[a+1] == b + 1) dp[1][b+1][0] = (dp[1][b+1][0] + dp[0][b][0]) % mod;
if(v[a+1] <= b) dp[1][b][1] = (dp[1][b][1] + (v[a+1] - 1) * dp[0][b][0]) % mod;
if(v[a+1] == b + 1) dp[1][b][1] = (dp[1][b][1] + b * dp[0][b][0]) % mod;
if(v[a+1] > b + 1) {
dp[1][b][1] = (dp[1][b][1] + b * dp[0][b][0]) % mod;
dp[1][b+1][1] = (dp[1][b+1][1] + dp[0][b][0]) % mod;
}
}
}
for(int b=1; b<=n; b++) {
for(int c=0; c<2; c++) {
dp[0][b][c] = dp[1][b][c];
dp[1][b][c] = 0;
}
}
}
long long ans = 0;
for(int i=1; i<=n; i++) ans = (ans + dp[0][i][1]) % mod;
cout << (ans + 1) % mod << '\n';
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... | ||||
