QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#825091#9750. 拼图LianYanWA 3ms3612kbC++201.1kb2024-12-21 17:19:272024-12-21 17:19:32

Judging History

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

  • [2024-12-21 17:19:32]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3612kb
  • [2024-12-21 17:19:27]
  • 提交

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)
        {
            cout << 4 << endl;
        }
        else if (d <= (t << 1) - 1)
        {
            cout << 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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3552kb

input:

2
4 0 0 0
4 4 4 4

output:

4
16

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3612kb

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