QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#788622 | #9750. 拼图 | isWFnoya# | WA | 4ms | 3956kb | C++20 | 1.2kb | 2024-11-27 17:41:47 | 2024-11-27 17:41:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PII;
const int N=1e6+10,mod=1e9+7;
char s[N];
int a,b,c,d;
vector<int> e[N];
bool check(int x,int y){
int bb=b,cc=c,dd=d;
if(bb>cc) swap(bb,cc);
int cnt1=0,cnt2=0;
int now=0;
if(now==0){
cnt1+=(x+1)/2,cnt2+=x/2;
}else{
cnt1+=x/2,cnt2+=(x+1)/2;
}
if(x&1) now^=1;
if(now==0){
cnt1+=(y+1)/2,cnt2+=y/2;
}else{
cnt1+=y/2,cnt2+=(y+1)/2;
}
if(x&1) now^=1;
if(now==0){
cnt1+=(x+1)/2,cnt2+=x/2;
}else{
cnt1+=x/2,cnt2+=(x+1)/2;
}
if(x&1) now^=1;
if(now==0){
cnt1+=(y+1)/2,cnt2+=y/2;
}else{
cnt1+=y/2,cnt2+=(y+1)/2;
}
if(x&1) now^=1;
if(cnt1>cnt2) swap(cnt1,cnt2);
if(bb<cnt1||cc<cnt2) return false;
return true;
}
void __(){
scanf("%d%d%d%d",&a,&b,&c,&d);
int mx=0;
if(a<4){
puts("0");
return;
}
int ans=4+min(b,c)*2;
for(int i=1;i<=d;i++){
for(int j=1;j<=d/i;j++){
if(check(i,j)){
// cout<<i<<" "<<j<<endl;
ans=max(ans,(i+2)*(j+2));
}
}
}
printf("%d\n",ans);
}
int main(){
int _=1;
cin>>_;
while(_--){
__();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3956kb
input:
2 4 0 0 0 4 4 4 4
output:
4 16
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 4ms
memory: 3956kb
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 4243rd lines differ - expected: '9', found: '12'