Submission #527111

#TimeUsernameProblemLanguageResultExecution timeMemory
527111squiddyCalvinball championship (CEOI15_teams)C++14
10 / 100
68 ms65540 KiB
#include <bits/stdc++.h> using namespace std; #define FOR(v, s, e) for (int v = s; v < e; v++) #define FOR_REV(v, s, e) for (int v = e - 1; v >= s; v--) #define MOD 1000007 int n, ans; int dp[10005][10005]; int pf[10005][10005]; int vals[10005]; int main() { cin >> n; FOR(i, 0, n) { dp[0][i] = 1; pf[0][i + 1] = pf[0][i] + 1; } FOR(i, 1, n) { FOR(j, 0, n) { dp[i][j] = pf[i - 1][j + 2]; pf[i][j + 1] = (pf[i][j] + dp[i][j]) % MOD; } } FOR_REV(i, 0, n) { cin >> vals[i]; } FOR(i, 0, n) { ans = (ans + pf[i][vals[i] - 1]) % MOD; } cout << (ans + 1) % MOD; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...