QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#780533#9750. 拼图Zpair#WA 2ms3944kbC++20771b2024-11-25 11:26:372024-11-25 11:26:37

Judging History

This is the latest submission verdict.

  • [2024-11-25 11:26:37]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3944kb
  • [2024-11-25 11:26:37]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
void solve(){
	int A,B,C,D;
	scanf("%d%d%d%d",&A,&B,&C,&D);
	if(A<4){
		puts("0");
		return;
	}
	int k1=min({B,C,D+1}),res1=k1*3-1+4;
	int k2=min({B,C,(D+4)/2}),res2=k2*4-4+4;
	A-=4;
	int r=(B-(k2-2)/2+2);
	int w=res2/r;
	int t=A/4;
	int mx=max(res1,res2);
	mx=max(mx,4);
	
	if(r%2==0){
		int nr=r/2;
		if(nr)mx=max(mx,res2+(t/nr*nr)*4);
	}
	if(w%2==0){
		int nw=w/2;
		if(nw)mx=max(mx,res2+(t/nw*nw)*4);
	}
	if(r%2==0&&w%2==0){
		for(int i=0;i<=t;++i){
			int xr=r+i*2;
			int nt=t-w*i/4;
			if(nt<0)continue;
			int nr=xr/2;
			if(nr)mx=max(mx,res2+i*w+(nt/nr*nr)*4);
		}
	}
	printf("%d\n",mx);
}
int main(){
	int T;cin>>T;
	while(T--)solve();
}
//4A kB kC (k-1)D
//4A kB kC (2k-4)D

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3944kb

input:

2
4 0 0 0
4 4 4 4

output:

4
16

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3752kb

input:

10000
0 0 0 0
0 0 0 1
0 0 0 2
0 0 0 3
0 0 0 4
0 0 0 5
0 0 0 6
0 0 0 7
0 0 0 8
0 0 0 9
0 0 1 0
0 0 1 1
0 0 1 2
0 0 1 3
0 0 1 4
0 0 1 5
0 0 1 6
0 0 1 7
0 0 1 8
0 0 1 9
0 0 2 0
0 0 2 1
0 0 2 2
0 0 2 3
0 0 2 4
0 0 2 5
0 0 2 6
0 0 2 7
0 0 2 8
0 0 2 9
0 0 3 0
0 0 3 1
0 0 3 2
0 0 3 3
0 0 3 4
0 0 3 5
0 0 3 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 4331st lines differ - expected: '10', found: '8'