QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#825142#9750. 拼图LianYanWA 4ms3644kbC++201.2kb2024-12-21 17:29:232024-12-21 17:29:24

Judging History

This is the latest submission verdict.

  • [2024-12-21 17:29:24]
  • Judged
  • Verdict: WA
  • Time: 4ms
  • Memory: 3644kb
  • [2024-12-21 17:29:23]
  • Submitted

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: 100
Accepted
time: 0ms
memory: 3644kb

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: 3568kb

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 4333rd lines differ - expected: '12', found: '10'