Submission #1053503

# Submission time Handle Problem Language Result Execution time Memory
1053503 2024-08-11T12:40:20 Z VMaksimoski008 Calvinball championship (CEOI15_teams) C++17
0 / 100
5 ms 604 KB
#include <bits/stdc++.h>
//#define int long long

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int n;
vector<int> v;
ll dp[1005][2];

ll f(int pos, int under) {
    if(pos == n + 1) return under;
    if(dp[pos][under] != -1) return dp[pos][under];

    ll ans = 0;
    for(int i=1; i<=pos; i++) {
        if(!under && i > v[pos]) continue;
        ans = (ans + f(pos+1, under|(i < v[pos])));
    }

    return dp[pos][under] = ans;
}

signed main() {
    memset(dp, -1, sizeof(dp));

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

    cout << f(1, 0) << '\n';
    return 0;
}
# 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 0 ms 348 KB Output isn't correct
2 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 0 ms 348 KB Output isn't correct
2 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 1 ms 452 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -