QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#825121#9750. 拼图LianYanWA 4ms3600kbC++201.2kb2024-12-21 17:25:402024-12-21 17:25:45

Judging History

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

  • [2024-12-21 17:25:45]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3600kb
  • [2024-12-21 17:25:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int a, b, c, d;
    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)
                cout << 6 << endl;
            else
                cout << 4 << endl;
        }
        else if (d <= (t << 1) - 1)
        {
            cout << max(4+4*t,4+d+2*(d+1)) << endl;
        }
        else if (d >= t * t)
        {
            cout << 4 + t * 4 + t * t << endl;
        }
        else
        {
            int ans = 0;
            for (int i = t; i >= 1; i--)
            {
                if (d >= i * (2 * t - i))
                {
                    ans = i * (2 * t - i) + 4 * t;
                    // cout << i << endl;
                    break;
                }
            }
            cout << ans + 4 << 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: 3600kb

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

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 4331st lines differ - expected: '10', found: '8'