QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863197#9750. 拼图xjt05WA 1ms3712kbC++232.3kb2025-01-19 14:21:352025-01-19 14:21:35

Judging History

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

  • [2025-01-19 14:21:35]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3712kb
  • [2025-01-19 14:21:35]
  • 提交

answer

#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<deque>
#include<cctype>
#include<string.h>
#include<math.h>
#include<time.h>
#include<random>
#include<stack>
#include<string>
#include<functional>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include<bits/stdc++.h>
#include <unordered_map>
#define ll            long long 
#define lowbit(x) (x & -x)
#define endl "\n"//                           交互题记得删除
using namespace std;
//using namespace __gnu_pbds;
mt19937 rnd(time(0));
const ll p = 998244353;
const ll mod = 998244353;
ll ksm(ll x, ll y)
{
	ll ans = 1;
	while (y)
	{
		if (y & 1)
		{
			ans = ans % mod * (x % mod) % mod;
		}
		x = x % mod * (x % mod) % mod;
		y >>= 1;
	}
	return ans % mod % mod;
}
ll gcd(ll x, ll y)
{
	if (y == 0)
		return x;

	else
		return gcd(y, x % y);
}
void fio()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
struct s
{
	ll l, r;
	bool operator<(const s& a)const
	{
		return l < a.l;
	}
};

int main()
{
	fio();
    ll t;
    cin>>t;
    while(t--)
    {
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        if(a<4)
        {
        cout<<0<<endl;
        continue;
        }
        ll ans=0;
        ans=max(ans,(ll)4);
        ll e=0;
        ll u=0,k=0;//b,c
        while(1)
        {
            e++;
            if(u*2>b||k*2>c)break;
            ll len=u+k;
            if((u+k)%2&&c-k*2>=2)//b多,对面c多
            {
                ll l=0,r=min((b-2*u)/2,(c-2*k-2)/2);
                while(l<=r)
                {
                    ll mid=(l+r)>>1;
                    ll row=mid*2+1;
                    if(row*len>d)r=mid-1;
                    else l=mid+1;
                }
                ans=max(ans,(len+2)*(r*2+3));
            }
            else//b,c一样多 
            {
                ll l=0,r=min((b-2*u),(c-2*k));
                while(l<=r)
                {
                    ll mid=(l+r)>>1;
                    ll row=mid;
                    if(row*len>d)r=mid-1;
                    else l=mid+1;
                }
                ans=max(ans,(len+2)*(r+2));
            }
            if(e%2)
            u++;
            else k++;
        }
        cout<<ans<<endl;
    }
}

详细

Test #1:

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

input:

2
4 0 0 0
4 4 4 4

output:

4
16

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3712kb

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 4201st lines differ - expected: '4', found: '6'