# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
154223 | mhy908 | Calvinball championship (CEOI15_teams) | C++14 | 4 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define mod 1000007
using namespace std;
typedef long long LL;
int n;
int arr[10010], maxx;
int newp[10010];
LL dp[10010];
LL temp=1, t2;
LL power(LL a, LL b)
{
if(b==0)return 1;
LL ret=power(a, b/2);
if(b%2)return ret*ret%mod*a%mod;
return ret*ret%mod;
}
int main()
{
scanf("%d", &n);
for(int i=1; i<=n; i++){
scanf("%d", &arr[i]);
maxx=max(maxx, arr[i]);
newp[i]=maxx;
}
dp[n+1]=1;
t2=n+1;
for(int i=n; i>=1; i--){
if(newp[i-1]==newp[i]){
temp+=(arr[i]-1)*power(newp[i], t2-i-1);
}
else{
temp+=(arr[i]-1)*power(newp[i], t2-i-1);
dp[i]=temp*dp[t2]%mod;
t2=i;
temp=1;
}
}
printf("%lld", dp[1]);
}
// 16603
컴파일 시 표준 에러 (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... |