提出 #76640807


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() 
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tt;
    cin >> tt;
    while(tt--)
    {
        ll a, b, x, y;
        cin >> a >> b >> x >> y;
        b = min(b, 3 * a);
        a = min(a, 3 * b);
        x = abs(x), y = abs(y);
        ll ans = 2 * min(x, y) * min(a, b);
        if(x > y)
            ans += (x - y + 1) / 2 * a + (x - y) / 2 * b;
        else
            ans += (y - x + 1) / 2 * b + (y - x) / 2 * a;
        cout << ans << '\n';
    }
    return 0;
}

提出情報

提出日時
問題 E - Alternating Costs
ユーザ aaa65654
言語 C++23 (GCC 15.2.0)
得点 450
コード長 588 Byte
結果 AC
実行時間 51 ms
メモリ 4524 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 450 / 450
結果
AC × 1
AC × 33
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3548 KiB
01_handmade_00.txt AC 27 ms 3624 KiB
01_handmade_01.txt AC 27 ms 3548 KiB
01_handmade_02.txt AC 27 ms 3560 KiB
01_handmade_03.txt AC 27 ms 3424 KiB
01_handmade_04.txt AC 27 ms 3592 KiB
01_handmade_05.txt AC 32 ms 3560 KiB
01_handmade_06.txt AC 31 ms 3384 KiB
01_handmade_07.txt AC 37 ms 3424 KiB
01_handmade_08.txt AC 35 ms 3436 KiB
01_handmade_09.txt AC 35 ms 3624 KiB
01_handmade_10.txt AC 35 ms 3440 KiB
01_handmade_11.txt AC 35 ms 3592 KiB
01_handmade_12.txt AC 35 ms 3548 KiB
01_handmade_13.txt AC 39 ms 3560 KiB
01_handmade_14.txt AC 39 ms 3440 KiB
01_handmade_15.txt AC 46 ms 4524 KiB
02_random_00.txt AC 50 ms 4264 KiB
02_random_01.txt AC 50 ms 4268 KiB
02_random_02.txt AC 50 ms 4264 KiB
02_random_03.txt AC 50 ms 4264 KiB
02_random_04.txt AC 45 ms 3592 KiB
02_random_05.txt AC 45 ms 3548 KiB
02_random_06.txt AC 45 ms 3560 KiB
02_random_07.txt AC 47 ms 3560 KiB
02_random_08.txt AC 49 ms 4264 KiB
02_random_09.txt AC 50 ms 4272 KiB
02_random_10.txt AC 50 ms 4268 KiB
02_random_11.txt AC 51 ms 4264 KiB
02_random_12.txt AC 50 ms 4272 KiB
02_random_13.txt AC 50 ms 4264 KiB
02_random_14.txt AC 51 ms 4268 KiB
02_random_15.txt AC 51 ms 4268 KiB