QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#577019 | #5146. Skills | kou_kou_kou | WA | 55ms | 4396kb | C++14 | 1.3kb | 2024-09-20 00:15:47 | 2024-09-20 00:15:48 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1000,M=142,inf=1e9;
int T,n,a[N+5][3],f[2][3][M+5][M+5];
//0 1 2
//1 2 0
//2 0 1
int main(){
for(scanf("%d",&T);T--;){
scanf("%d",&n);
for(int i=1;i<=n;i++){
for(int j=0;j<=2;j++){
scanf("%d",&a[i][j]);
}
}
int o=0,ans=0;
memset(f,0,sizeof(f));
for(int i=1;i<=n;i++){
for(int j=0;j<=2;j++){
for(int x=0;x<=M;x++){
for(int y=0;y<=M;y++){
int tx=x?x+1:0,ty=y?y+1:0,k=j;
f[o^1][k][tx][ty]=max(f[o^1][k][tx][ty],f[o][j][x][y]+a[i][k]-tx-ty);
k++;k=k<3?k:0;
f[o^1][k][ty][1]=max(f[o^1][k][ty][1],f[o][j][x][y]+a[i][k]-ty-1);
k++;k=k<3?k:0;
f[o^1][k][1][tx]=max(f[o^1][k][1][tx],f[o][j][x][y]+a[i][k]-tx-1);
}
}
}
o^=1;
}
for(int j=0;j<=2;j++){
for(int x=0;x<=M;x++){
for(int y=0;y<=M;y++){
ans=max(ans,f[o][j][x][y]);
}
}
}
printf("%d\n",ans);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 4264kb
input:
2 3 1 1 10 1 10 1 10 1 1 5 1 2 3 6 5 4 7 8 9 12 11 10 13 14 15
output:
26 41
result:
ok 2 number(s): "26 41"
Test #2:
score: 0
Accepted
time: 37ms
memory: 4260kb
input:
1 200 6219 3608 2383 1139 2158 8611 6721 8216 8887 8736 6707 9755 7210 248 167 3849 276 8050 971 5062 1914 8290 1562 6017 8993 7990 3460 6323 6099 757 7652 4740 6117 6560 4206 180 3705 8906 5752 9619 8939 9696 793 6680 1777 384 3606 8772 9258 3906 709 4396 5083 6614 6057 4410 3132 8596 825 7437 6098...
output:
1505431
result:
ok 1 number(s): "1505431"
Test #3:
score: 0
Accepted
time: 37ms
memory: 4260kb
input:
1 200 7577 2771 7429 8435 7489 1440 1929 8819 818 7849 8462 8761 3344 5938 3673 9434 8897 6486 4668 636 8139 4777 3305 4238 4221 3326 639 3879 7469 1590 6370 9514 4307 6243 3301 8122 4967 184 9327 6142 1710 399 6814 9296 6270 5663 3564 5442 8315 1295 869 2635 7975 4837 9613 9439 4012 6660 1861 368 8...
output:
1497632
result:
ok 1 number(s): "1497632"
Test #4:
score: -100
Wrong Answer
time: 55ms
memory: 4396kb
input:
1 300 0 10000 0 0 10000 0 0 10000 0 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 1000...
output:
2975224
result:
wrong answer 1st numbers differ - expected: '2975228', found: '2975224'