Submission #449689

#TimeUsernameProblemLanguageResultExecution timeMemory
449689fuad27Calvinball championship (CEOI15_teams)C++14
10 / 100
319 ms65540 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define mod 1000007 int memo[10010][10010] = {0}; int f(int a, int b) { if(memo[a][b]!=0)return memo[a][b]; if(a == 0)return 1; return memo[a][b] = (((b%mod)*(f(a-1, b)%mod))%mod+(f(a-1, b+1)%mod))%mod; } int32_t main () { int n, ans = 0; cin >> n; int MAX = 0, a[n]; for(int i = 0;i<n;i++) { cin >> a[i]; } MAX = a[0]; int i = 0; if(n > 1) ans = (f(n-i-1, MAX)*(a[i+1]-1))%mod; else ans = 1; cout<<ans<<endl; }
#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...