QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#767830#5146. SkillsAlicXWA 56ms4848kbC++142.1kb2024-11-20 22:17:302024-11-20 22:17:31

Judging History

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

  • [2024-11-20 22:17:31]
  • 评测
  • 测评结果:WA
  • 用时:56ms
  • 内存:4848kb
  • [2024-11-20 22:17:30]
  • 提交

answer

#include<bits/stdc++.h> 
#define ll long long 
#define x first 
#define y second 
#define il inline 
#define em emplace 
#define eb emplace_back 
#define debug() puts("-----") 
using namespace std; 
typedef pair<int,int> pii; 
il 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<<1)+(x<<3)+(ch^48),ch=getchar(); 
	return x*f; 
} 
const int N=1e3+10,V=210; 
int n; 
int a[N][3]; 
int f[2][3][V][V]; 
il void solve(){ 
	n=read(); int Max=0; 
	for(int i=1;i<=n;i++){ 
		for(int j=0;j<=2;j++){ 
			a[i][j]=read(); 
			Max=max(Max,a[i][j]); 
		} 
	} Max=2*sqrt(Max)+1; 
	int p=0; 
	for(int i=0;i<=n;i++){ 
		for(int j=0;j<=2;j++){ 
			for(int p1=0;p1<=Max;p1++){ 
				for(int p2=0;p2<=Max;p2++) f[p][j][p1][p2]=0; 
			} 
		} 
	} for(int i=0;i<n;i++){ 
		for(int j=0;j<=2;j++){ 
			for(int p1=0;p1<=Max;p1++){
				for(int p2=0;p2<=Max;p2++){ 
					f[p^1][j][p1][p2]=0; 	
				} 
			}	
		} for(int j=0;j<=2;j++){ 
			for(int p1=0;p1<=Max;p1++){ 
				for(int p2=0;p2<=Max;p2++){ 
					int k1=0,k2=0; 
					if(p1) k1=p1+1; if(p2) k2=p2+1; 
					f[p^1][j][k1][k2]=max(f[p^1][j][k1][k2],f[p][j][p1][p2]-k1-k2+a[i+1][j]); 
					if(!j){ 
						f[p^1][1][1][k2]=max(f[p^1][1][1][k2],f[p][j][p1][p2]-1-k2+a[i+1][1]); 
						f[p^1][2][k1][1]=max(f[p^1][2][k1][1],f[p][j][p1][p2]-1-k1+a[i+1][2]); 
					} if(j==1){ 
						f[p^1][0][1][k2]=max(f[p^1][0][1][k2],f[p][j][p1][p2]-1-k2+a[i+1][0]); 
						f[p^1][2][k1][1]=max(f[p^1][2][k1][1],f[p][j][p1][p2]-1-k1+a[i+1][2]); 
					} if(j==2){ 
						f[p^1][0][k2][1]=max(f[p^1][0][k2][1],f[p][j][p1][p2]-1-k2+a[i+1][0]); 
						f[p^1][1][k1][1]=max(f[p^1][1][k1][1],f[p][j][p1][p2]-1-k1+a[i+1][1]); 
					} 
				} 
			}  
		} p^=1; 
	} int ans=0; 
	for(int j=0;j<=2;j++) for(int p1=0;p1<=Max;p1++) for(int p2=0;p2<=Max;p2++) ans=max(ans,f[p][j][p1][p2]); 
	printf("%d\n",ans); 
} 
signed main(){ 
	int T=read(); 
	while(T--) solve(); 
	return 0; 
} /*
1
3
1 1 10
1 10 1
10 1 1

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
*/

詳細信息

Test #1:

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

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: 56ms
memory: 4848kb

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'