Submission #1251475

#TimeUsernameProblemLanguageResultExecution timeMemory
1251475chikien2009Calvinball championship (CEOI15_teams)C++20
10 / 100
241 ms560 KiB
#include <bits/stdc++.h> using namespace std; void setup() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const int mod = 1e6 + 7; int n, f[10001], g[10001], a[10001], res; int main() { setup(); cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } reverse(a + 1, a + 1 + n); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n - i + 1; ++j) { g[j] = (i == 1 ? j : f[j + 1] + g[j - 1]) % mod; } (res += (i == 1 ? g[a[i]] : g[a[i] - 1])) %= mod; for (int j = 1; j <= n; ++j) { f[j] = g[j]; } } cout << res; return 0; }
#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...