Submission #527171

#TimeUsernameProblemLanguageResultExecution timeMemory
527171squiddyCalvinball championship (CEOI15_teams)C++14
70 / 100
58 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, cmax = 1; int pf[10005][10005]; int main() { cin >> n; FOR(i, 0, n) { pf[0][i] = 1; } FOR(i, 1, n) { FOR(j, 0, n) { pf[i][j] = ((j + 1) * pf[i - 1][j] + pf[i - 1][j + 1]) % MOD; } } FOR_REV(i, 0, n) { int cval; cin >> cval; ans = (ans + (cval - 1) * pf[i][cmax - 1]) % MOD; cmax = max(cmax, cval); } 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...