Submission #1053571

# Submission time Handle Problem Language Result Execution time Memory
1053571 2024-08-11T13:24:38 Z VMaksimoski008 Calvinball championship (CEOI15_teams) C++17
10 / 100
1000 ms 23636 KB
#include <bits/stdc++.h>
#define int long long
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 0 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 348 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 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 90 ms 4176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 692 ms 11600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1033 ms 11364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 723 ms 23632 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 717 ms 23636 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -