Submission #1107700

# Submission time Handle Problem Language Result Execution time Memory
1107700 2024-11-02T02:17:05 Z 12345678 Calvinball championship (CEOI15_teams) C++17
30 / 100
1000 ms 592 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

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

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

ll solve(ll l, ll mx)
{
    if (l==0) return 1;
    return (solve(l-1, mx)*mx+solve(l-1, mx+1))%mod;
}

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++) 
    {
        cin>>a[i];
        for (int j=1; j<a[i]; j++) res=(res+solve(n-i, h))%mod;
        h=max(h, a[i]);    
    }
    cout<<res+1;
}
# 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 588 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 504 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 Execution timed out 1067 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -