Submission #207668

#TimeUsernameProblemLanguageResultExecution timeMemory
207668alexandra_udristoiuCalvinball championship (CEOI15_teams)C++14
100 / 100
347 ms608 KiB
#include<iostream> #define mod 1000007 using namespace std; int n, t, i, j, k; int d[2][10005], v[10005], maxim[10005]; int main(){ cin>> n; for(i = 1; i <= n; i++){ cin>> v[i]; maxim[i] = max(maxim[i - 1], v[i]); } for(i = 1; i <= n; i++){ d[0][i] = 1; } t = 1; for(i = n; i >= 2; i--){ for(j = 1; j < i; j++){ d[t][j] = d[1 - t][j + 1]; d[t][j] = (d[t][j] + j * 1LL * d[1 - t][j]) % mod; } for(j = 1; j < v[i]; j++){ k = (k + d[1 - t][ maxim[i - 1] ]) % mod; } t = 1 - t; } k = (1 + k) % mod; cout<< k; }
#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...