Submission #449650

# Submission time Handle Problem Language Result Execution time Memory
449650 2021-08-02T07:39:10 Z fuad27 Calvinball championship (CEOI15_teams) C++14
0 / 100
344 ms 65540 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
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));
	else ans = 1;
	cout<<ans<<endl;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 716 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 3276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 8340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 335 ms 65540 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Runtime error 334 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 344 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -