# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
244452 | cheeheng | Calvinball championship (CEOI15_teams) | C++14 | 741 ms | 8440 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000007;
int A[1005];
int memo[1005][1005][2];
int n;
int dp(int i, int cur_max, int same_so_far){
if(i == n){
return 1;
}else if(memo[i][cur_max][same_so_far] != -1){
return memo[i][cur_max][same_so_far];
}else{
long long ans = 0;
if(same_so_far){
for(int j = 1; j <= A[i]; j ++){
ans += dp(i+1, max(cur_max, j), j == A[i]);
}
}else{
for(int j = 1; j <= cur_max+1; j ++){
ans += dp(i+1, max(cur_max, j), 0);
}
}
return memo[i][cur_max][same_so_far] = ans%MOD;
}
}
int main(){
scanf("%d", &n);
for(int i = 0; i < n; i ++){
scanf("%d", &A[i]);
}
memset(memo, -1, sizeof(memo));
printf("%d", dp(0, 0, 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... |