QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#648094 | #9220. Bus Analysis | BINYU | WA | 2ms | 8568kb | C++14 | 1.1kb | 2024-10-17 17:00:38 | 2024-10-17 17:00:40 |
Judging History
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'