Submission #244444

#TimeUsernameProblemLanguageResultExecution timeMemory
244444dwscCalvinball championship (CEOI15_teams)C++14
100 / 100
732 ms888 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int MOD = 1e6+7; int memo[2][10010][2]; int arr[10010]; int n; main(){ cin >> n; for (int i = 0; i < n; i++){ int x; cin >> x; arr[i] = x; } for (int i = 0; i <= n; i++) memo[n%2][i][0] = memo[n%2][i][1] = 1; for (int i = n-1; i >= 0; i--){ for (int j = 0; j <= i; j++){ int curnum = arr[i]; int ans = ((curnum-1)*memo[1-i%2][j][0]); ans += memo[1-i%2][max(j,curnum)][1]; memo[i%2][j][1] = ans%MOD; int ans2 = (j*memo[1-i%2][j][0]) + memo[1-i%2][j+1][0]; memo[i%2][j][0] = ans2%MOD; } } cout << memo[0][0][1]; }

Compilation message (stderr)

teams.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#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...