Submission #1053562

# Submission time Handle Problem Language Result Execution time Memory
1053562 2024-08-11T13:15:09 Z VMaksimoski008 Calvinball championship (CEOI15_teams) C++17
10 / 100
1000 ms 14584 KB
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e6 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;

int dp[1005][1005][2];

signed main() {
    int n;
    cin >> n;

    vector<int> v(n+1);
    for(int i=1; i<=n; i++) cin >> v[i];

    dp[1][1][0] = 1;
    for(int i=1; i<n; i++) {
        for(int j=1; j<=i; j++) {
            for(int k=0; k<2; k++) {
                for(int x=1; x<=j+1; x++) {
                    if(!k && x > v[i+1]) continue;
                    dp[i+1][max(j, k)][k|(x<v[i+1])] = (dp[i+1][max(j, k)][k|(x<v[i+1])] + dp[i][j][k]) % mod;
                }
            }
        }
    }

    long long ans = 0;
    for(int i=1; i<=n; i++) ans = (ans + dp[n][i][1]) % mod;
    cout << (ans + 1) % mod << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 3188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 671 ms 7284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 14584 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 695 ms 14436 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 701 ms 14504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -