QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#648094#9220. Bus AnalysisBINYUWA 2ms8568kbC++141.1kb2024-10-17 17:00:382024-10-17 17:00:40

Judging History

你现在查看的是最新测评结果

  • [2024-10-17 17:00:40]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:8568kb
  • [2024-10-17 17:00:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
const int N = 1000;
const ll mod = 1e9 + 7;
int n,a[N + 5];
ll dp[2][85][85][85],ans,f[N + 5] = {1};
signed main()
{
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)
		scanf("%d",&a[i]),f[i] = f[i - 1] * 2 % mod;
	dp[0][0][0][0] = 2;
	for(int i = 1;i <= n;i++)
	{
		int o = i & 1;
		for(int j0 = 0;j0 <= 20;j0++)
		for(int j1 = j0;j1 <= 40;j1++)
		for(int j2 = j1;j2 <= 75;j2++)
			dp[o][j0][j1][j2] = 0;
		for(int j0 = 0;j0 <= 20;j0++)
		for(int j1 = j0;j1 <= 40;j1++)
		for(int j2 = j1;j2 <= 75;j2++)
		{
			int nj0 = max(0ll,j0 - (a[i] - a[i - 1])); 
			int nj1 = max(nj0 + 20,j1 - (a[i] - a[i - 1])); 
			int nj2 = max(nj1 + 20,j2 - (a[i] - a[i - 1]));
			int nj3 = max(nj0 + 75,nj2 + 20);
			(dp[o][nj0][nj1][nj2] += dp[o ^ 1][j0][j1][j2]) %= mod;
			if(!nj0)
				(dp[o][nj1][nj2][nj3] += dp[o ^ 1][j0][j1][j2]) %= mod,
				(ans += dp[o ^ 1][j0][j1][j2] * f[n - i] % mod) %= mod;
			else (dp[o][nj0][nj1][nj2] += dp[o ^ 1][j0][j1][j2]) %= mod;
		}
	}
	cout<<ans<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 8568kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 6428kb

input:

5
25 45 65 85 1000000000

output:

124

result:

wrong answer 1st numbers differ - expected: '156', found: '124'