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 |
---|---|---|---|---|---|---|---|---|---|
#794058 | #9750. 拼图 | pengpeng_fudan# | TL | 3ms | 3632kb | C++23 | 623b | 2024-11-30 10:22:51 | 2024-11-30 10:22:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
void solve(){
int a,b,c,d;
cin>>a>>b>>c>>d;
int sum=a+b+c+d;
if(a<4){
cout<<"0\n";
return ;
}
int ans=4;
for(int i=0;i<=sum;i++){
for(int j=0;j<=sum;j++){
int l1=i,l2=j;
if(a>=4&&b>=l1+l2&&c>=l1+l2&&d>=l1*l2){
ans=max(ans,1ll*(l1+2)*(l2+2));
}
}
}
cout<<ans<<'\n';
}
signed main() {
ios::sync_with_stdio(0),cin.tie(0);
int _ = 1;
cin>>_;
while(_--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
input:
2 4 0 0 0 4 4 4 4
output:
4 16
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 3ms
memory: 3600kb
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:
ok 10000 lines
Test #3:
score: -100
Time Limit Exceeded
input:
10000 931 537 776 551 811 819 334 584 895 420 468 352 954 224 103 732 643 617 385 978 608 310 256 303 561 212 871 741 324 192 179 44 949 54 897 852 388 181 293 91 265 511 49 91 640 354 190 947 886 688 330 526 708 353 725 669 47 997 339 760 417 414 873 495 902 342 778 406 402 529 950 616 73 267 114 7...