QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#825156#9750. 拼图LianYanWA 0ms3664kbC++201.2kb2024-12-21 17:32:132024-12-21 17:32:17

Judging History

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

  • [2024-12-21 17:32:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3664kb
  • [2024-12-21 17:32:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int a, b, c, d;
    int ans = 0;
    cin >> a >> b >> c >> d;
    int t = min(b, c);
    // t >>= 1;
    if (a < 4)
    {
        cout << 0 << endl;
        return;
    }
    else
    {
        if (t == 0)
        {
            if (b >= 1 && c >= 1)
                ans = 6;
            else
                ans = 4;
        }
        else if (d <= (t << 1) - 1)
        {

            ans = 4 + d + 2 * (d + 1);
        }
        else if (d >= t * t)
        {
            ans = 4 + t * 4 + t * t;
        }
        else
        {
            for (int i = t; i >= 1; i--)
            {
                if (d >= i * (2 * t - i))
                {
                    ans = i * (2 * t - i) + 4 * t;
                    cout << i << endl;
                    break;
                }
            }
            ans += 4;
        }
    }
    ans = max(ans, 4 + min(b, c) * 2);
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T;
    cin >> T;
    while (T--)
        solve();
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3664kb

input:

2
4 0 0 0
4 4 4 4

output:

4
18

result:

wrong answer 2nd lines differ - expected: '16', found: '18'