Submission #1107701

# Submission time Handle Problem Language Result Execution time Memory
1107701 2024-11-02T02:19:33 Z 12345678 Calvinball championship (CEOI15_teams) C++17
70 / 100
29 ms 16464 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=1e3+5, mod=1e6+7;

ll n, a[nx], h, res, dp[nx][nx];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    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]*j+dp[i-1][j+1])%mod;
    for (int i=1; i<=n; i++) 
    {
        cin>>a[i];
        for (int j=1; j<a[i]; j++) res=(res+dp[n-i][h])%mod;
        h=max(h, a[i]);    
    }
    cout<<(res+1)%mod;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4688 KB Output is correct
2 Correct 2 ms 4564 KB Output is correct
3 Correct 2 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8444 KB Output is correct
2 Correct 4 ms 8272 KB Output is correct
3 Correct 6 ms 8272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 16464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 16464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 16464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -