QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#586042 | #9220. Bus Analysis | Displace_ | WA | 37ms | 7772kb | C++14 | 1.9kb | 2024-09-24 00:15:38 | 2024-09-24 00:15:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
//#define int long long
const int N=1100,M=77,mod=1e9+7;
int n,ans;
int a[N];
int f[2][M][M][M],g[2][M][M][M],id;
void gmod(int &x){
if(x>=mod) x-=mod;
}
int getval(int x,int y,int z,int pos){
if(pos<=x) return 0;
if(pos<=y) return 1;
if(pos<=z) return 2;
return 3;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
f[0][75][75][75]=1;
id=0;
for(int i=1;i<=n;i++){
id^=1;
for(int x=0;x<=75;x++)
for(int y=min(x+20,75);y<=75;y++)
for(int z=min(y+20,75);z<=75;z++)
f[id][x][y][z]=0;
for(int x=0;x<=75;x++){
for(int y=min(x+20,75);y<=75;y++){
for(int z=min(y+20,75);z<=75;z++){
if(!f[id^1][x][y][z]) continue;
int pos1=min((a[i]-20)-(a[i-1]-75),75),pos2=min((a[i]-75)-(a[i-1]-75),75);
int val1=getval(x,y,z,pos1),val2=getval(x,y,z,pos2);
int nx,ny,nz,d=a[i]-a[i-1];
int ix=x,iy=y,iz=z;
if(ix==75) ix+=d;
if(iy==75) iy+=d;
if(iz==75) iz+=d;
if(val2==0) nx=ix-d,ny=iy-d,nz=iz-d;
else if(val2==1) nx=iy-d,ny=iz-d,nz=75;
else if(val2==2) nx=iz-d,ny=75,nz=75;
else if(val2==3) nx=75,ny=75,nz=75;
//shift to current position
gmod(f[id][nx][ny][nz]+=f[id^1][x][y][z]);
gmod(g[id][nx][ny][nz]+=(g[id^1][x][y][z]+1ll*f[id^1][x][y][z]*val2%mod)%mod);
//0: old base
//val2: new base
//do not choose
int val=min(1+val1,3+val2);
int del=val-val2;
if(del==1) nx=min(nx,74);
if(del==2) nx=min(nx,74),ny=min(ny,74);
if(del==3) nx=min(nx,74),ny=min(ny,74),nz=min(nz,74);
gmod(f[id][nx][ny][nz]+=f[id^1][x][y][z]);
gmod(g[id][nx][ny][nz]+=(g[id^1][x][y][z]+1ll*f[id^1][x][y][z]*val2%mod)%mod);
gmod(ans+=(g[id^1][x][y][z]+1ll*f[id^1][x][y][z]*val%mod)%mod);
//choose
}
}
}
}
cout<<ans*2%mod;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 6296kb
input:
3 1 8 20
output:
14
result:
ok 1 number(s): "14"
Test #2:
score: 0
Accepted
time: 1ms
memory: 6388kb
input:
5 25 45 65 85 1000000000
output:
156
result:
ok 1 number(s): "156"
Test #3:
score: -100
Wrong Answer
time: 37ms
memory: 7772kb
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:
270649239
result:
wrong answer 1st numbers differ - expected: '932594593', found: '270649239'