QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#268994 | #5146. Skills | Terk | WA | 67ms | 498284kb | C++14 | 1.4kb | 2023-11-29 09:54:15 | 2023-11-29 09:54:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+5,W=205;
int n;
int Rem[N][3],Gy[N][W][W][3];
void Max(int &a,int b){
if(b>a) a=b;
}
int nxt(int x){//注意不要直接+1 因为0的话就不会加 所以开个函数算方便
return x==0?0:x+1;
}
int main(){
int t;
cin>>t;
while(t--){
cin>>n;
for(int i=1;i<=n;i++) cin>>Rem[i][0]>>Rem[i][1]>>Rem[i][2];
memset(Gy,-0x3f,sizeof(Gy));
Gy[0][0][0][0]=Gy[0][0][0][1]=Gy[0][0][0][2]=0;
for(int i=0;i<n;i++){
for(int j=0;j<205;j++){
for(int k=0;k<205;k++){
Max(Gy[i+1][nxt(j)][nxt(k)][0],Gy[i][j][k][0]+Rem[i+1][0]-nxt(j)-nxt(k));
Max(Gy[i+1][1][nxt(k)][1],Gy[i][j][k][0]+Rem[i+1][1]-nxt(k)-1);
Max(Gy[i+1][nxt(j)][1][2],Gy[i][j][k][0]+Rem[i+1][2]-nxt(j)-1);
Max(Gy[i+1][1][nxt(k)][0],Gy[i][j][k][1]+Rem[i+1][0]-nxt(k)-1);
Max(Gy[i+1][nxt(j)][nxt(k)][1],Gy[i][j][k][1]+Rem[i+1][1]-nxt(j)-nxt(k));
Max(Gy[i+1][nxt(j)][1][2],Gy[i][j][k][1]+Rem[i+1][2]-nxt(j)-1);
Max(Gy[i+1][nxt(k)][1][0],Gy[i][j][k][2]+Rem[i+1][0]-nxt(k)-1);
Max(Gy[i+1][nxt(j)][1][1],Gy[i][j][k][2]+Rem[i+1][1]-nxt(j)-1);
Max(Gy[i+1][nxt(j)][nxt(k)][2],Gy[i][j][k][2]+Rem[i+1][2]-nxt(j)-nxt(k));
}
}
}
int ans=0;//可以都不选
for(int j=0;j<205;j++){
for(int k=0;k<205;k++){
ans=max(ans,max(Gy[n][j][k][0],max(Gy[n][j][k][1],Gy[n][j][k][2])));
}
}
cout<<ans<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 59ms
memory: 498244kb
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: -100
Wrong Answer
time: 67ms
memory: 498284kb
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:
1505397
result:
wrong answer 1st numbers differ - expected: '1505431', found: '1505397'