Submission #857884

# Submission time Handle Problem Language Result Execution time Memory
857884 2023-10-07T06:34:55 Z Muhammad_Aneeq Calvinball championship (CEOI15_teams) C++17
10 / 100
41 ms 65536 KB
#include <iostream>
using namespace std;
#define int long long
int mod= 1e6+7;
signed main()
{
	int n;
	cin>>n;
	int a[n];
	for (auto& i:a)
		cin>>i;
	int dp[n+10][n+10]={};
	for (int i=1;i<=n;i++)
		dp[i][n]=1;
	for (int i=n-1;i>=1;i--)
	{
		int z=0;
		for (int j=1;j<=i;j++)
		{
			dp[j][i]+=dp[j][i+1]+dp[j+1][i+1]+z;
			dp[j][i]%=mod;
			z+=dp[j][i+1];
			z%=mod;
		}
	}
	int ans=0;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<a[i-1];j++)
		{
			ans+=dp[j][i];
			ans%=mod;
		}
	}
	ans++;
	ans%=mod;
	cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 8284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 36 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 37 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -