QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#270762#5146. SkillsC1942huangjiaxuWA 30ms4972kbC++14883b2023-12-01 13:47:192023-12-01 13:47:20

Judging History

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

  • [2023-12-01 13:47:20]
  • 评测
  • 测评结果:WA
  • 用时:30ms
  • 内存:4972kb
  • [2023-12-01 13:47:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1005,B=205;
int T,n,a[N][3],f[2][3][B][B],ans;
void solve(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)for(int j=0;j<3;++j)scanf("%d",&a[i][j]);
	memset(f,0,sizeof(f));
	for(int i=0,p=0,q=1;i<n;++i,p^=1,q^=1){
		for(int j=0;j<3;++j)
			for(int k=0;k<B&&k<=i;++k)
				for(int l=0;l<B&&l<=i;++l){
					int u=k?k+1:0,v=l?l+1:0;
					if(u<B&&v<B)f[q][j][u][v]=max(f[q][j][u][v],f[p][j][k][l]+a[i+1][j]-u-v);
					if(v<B)f[q][(j+1)%3][v][1]=max(f[q][(j+1)%3][v][1],f[p][j][k][l]-a[i+1][(j+1)%3]-1-v);
					if(u<B)f[q][(j+2)%3][1][u]=max(f[q][(j+2)%3][1][u],f[p][j][k][l]+a[i+1][(j+2)%3]-1-u);
					f[p][j][k][l]=0;
				}
	}
	ans=0;
	for(int i=0;i<3;++i)for(int j=0;j<B;++j)for(int k=0;k<B;++k)ans=max(ans,f[n&1][i][j][k]);
	printf("%d\n",ans);
}
int main(){
	scanf("%d",&T);
	while(T--)solve();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 4860kb

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: 30ms
memory: 4972kb

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:

1412106

result:

wrong answer 1st numbers differ - expected: '1505431', found: '1412106'