Submission #230105

#TimeUsernameProblemLanguageResultExecution timeMemory
230105parsa_mobedCalvinball championship (CEOI15_teams)C++14
100 / 100
388 ms504 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e4 + 5, MOD = 1e6 + 7; int dp[N], a[N]; int main() { int n, mx = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { for (int j = n; j >= 2; j--) dp[j] = (1ll * dp[j] * j % MOD + dp[j - 1]) % MOD; dp[mx] = (dp[mx] + a[i] - 1) % MOD, mx = max(mx, a[i]); } int ans = 0; for (int i = 1; i <= n; i++) ans = (ans + dp[i]) % MOD; cout << ans + 1 << "\n"; }
#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...