QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#563808#9220. Bus AnalysisgeneralsWA 273ms10716kbC++201.7kb2024-09-14 16:06:212024-09-14 16:06:21

Judging History

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

  • [2024-09-14 16:06:21]
  • 评测
  • 测评结果:WA
  • 用时:273ms
  • 内存:10716kb
  • [2024-09-14 16:06:21]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define mod 1000000007ll
#define pii pair<int,int>
#define fi first
#define se second
#define mems(x,y) memset(x,y,sizeof(x))
#define pb push_back
using namespace std;
const int maxn=1010;
const int inf=1e18;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch-48);ch=getchar();}
	return x*f;
}
bool Mbe;

int n,a[maxn],ans;
int dp[2][76][76][76],pw[maxn],f[6],cur;
void inc(int &u,int v){((u+=v)>=mod)&&(u-=mod);}
void work(){
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	pw[0]=1;for(int i=1;i<=n;i++)inc(pw[i]=pw[i-1],pw[i-1]);
	dp[0][0][0][0]=1;
	for(int i=1;i<=n;i++){
		int d=a[i]-a[i-1];
		mems(dp[i&1],0);
		for(int a=0;a<=75;a++){
			for(int b=0;b<=75;b++){
				for(int c=0;c<=75;c++)if(dp[cur][a][b][c]){
					// cout<<i<<" "<<a<<" "<<b<<" "<<c<<" "<<dp[cur][a][b][c]<<"\n";
					int aa=max(0ll,a-d),bb=max(0ll,b-d),cc=max(0ll,c-d);
					f[0]=aa,f[1]=bb,f[2]=cc,f[3]=f[4]=f[5]=0;
					for(int j=0;j<5;j++){
						f[j+1]=max(f[j+1],f[j]+20);
						if(i+3<6)f[j+3]=max(f[j+3],f[j]+75);
					}
					for(int j=1;j<=5;j++)f[j]=max(f[j],f[j-1]);
					inc(dp[i&1][f[0]][f[1]][f[2]],dp[cur][a][b][c]);
					int p=0;while(!f[p])p++;
					(ans+=dp[cur][a][b][c]*pw[n-i]*p)%=mod;
					inc(dp[i&1][f[p]][f[p+1]][f[p+2]],dp[cur][a][b][c]);
				}
			}
		}
		cur^=1;
	}
	printf("%lld\n",ans*2%mod);
}

// \
444

bool Med;
int T;
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);
	
	// cerr<<(&Mbe-&Med)/1048576.0<<" MB\n";
	
	T=1;
	while(T--)work();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 10636kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 0ms
memory: 10624kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 273ms
memory: 10716kb

input:

1000
2 7 9 12 14 17 18 21 22 28 29 33 34 35 37 38 44 45 46 50 58 59 63 66 71 72 75 76 77 78 80 81 83 84 87 92 100 101 107 108 109 112 114 116 118 123 124 131 142 143 144 145 148 150 151 152 153 155 157 158 165 167 168 169 171 176 182 185 190 192 198 202 204 205 212 213 223 224 225 226 229 231 240 24...

output:

574701987

result:

wrong answer 1st numbers differ - expected: '932594593', found: '574701987'