답안 #527307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
527307 2022-02-17T05:51:59 Z beepbeepsheep Calvinball championship (CEOI15_teams) C++17
70 / 100
145 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define ll long long
#define ii pair<ll,ll>
#define endl '\n'
const ll inf=1e15;
const ll mod=1e6+7;
const ll maxn=3005;

int dp[maxn][maxn];
ll solve(ll digit, ll rem){
    if (rem==0) return 1;
    if (dp[digit][rem]!=-1) return dp[digit][rem];
    ll ans=0;
    ans=(solve(digit,rem-1)*digit)%mod+solve(digit+1,rem-1);
    return dp[digit][rem]=ans%mod;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,ele,ans=0;
    cin>>n;
    ll ele2=0,temp;
    memset(dp,-1,sizeof(dp));
    for (int i=1;i<=n;i++){
        cin>>ele;
        for (int j=1;j<ele;j++){
            temp=max<ll>(j,ele2);
            ans+=solve(temp,n-i);
            ans%=mod;
        }
        ele2=max(ele,ele2);
    }
    cout<<(ans+1)%mod;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 35616 KB Output is correct
2 Correct 14 ms 35556 KB Output is correct
3 Correct 14 ms 35632 KB Output is correct
4 Correct 15 ms 35616 KB Output is correct
5 Correct 14 ms 35532 KB Output is correct
6 Correct 15 ms 35628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 35548 KB Output is correct
2 Correct 15 ms 35600 KB Output is correct
3 Correct 14 ms 35560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 35552 KB Output is correct
2 Correct 16 ms 35652 KB Output is correct
3 Correct 15 ms 35632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 35660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 35532 KB Output is correct
2 Correct 15 ms 35616 KB Output is correct
3 Correct 14 ms 35632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 35660 KB Output is correct
2 Correct 17 ms 35676 KB Output is correct
3 Correct 16 ms 35668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 35660 KB Output is correct
2 Correct 20 ms 35676 KB Output is correct
3 Correct 25 ms 35564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 145 ms 65536 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 71 ms 35824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 79 ms 36044 KB Output isn't correct
2 Halted 0 ms 0 KB -