提出 #76664636


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void solve() {
    ll A, B, X, Y;
    cin >> A >> B >> X >> Y;

    ll H = abs(X);
    ll V = abs(Y);
    ll N = H + V;

    if (N == 0) {
        cout << "0\n";
        return;
    }

    ll half = (A + B) / 2;

    if (N % 2 == 0) {
        cout << N * half << "\n";
    } else {
        ll base = (N - 1) * half;
        cout << min(base + A, base + B) << "\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while (T--) solve();
}

提出情報

提出日時
問題 E - Alternating Costs
ユーザ Axiom_
言語 C++23 (GCC 15.2.0)
得点 0
コード長 597 Byte
結果 WA
実行時間 45 ms
メモリ 4524 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 450
結果
WA × 1
AC × 5
WA × 28
セット名 テストケース
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 WA 1 ms 3496 KiB
01_handmade_00.txt AC 26 ms 3388 KiB
01_handmade_01.txt WA 26 ms 3576 KiB
01_handmade_02.txt WA 26 ms 3512 KiB
01_handmade_03.txt WA 26 ms 3576 KiB
01_handmade_04.txt WA 26 ms 3412 KiB
01_handmade_05.txt WA 31 ms 3424 KiB
01_handmade_06.txt WA 31 ms 3652 KiB
01_handmade_07.txt AC 34 ms 3496 KiB
01_handmade_08.txt AC 33 ms 3652 KiB
01_handmade_09.txt WA 33 ms 3592 KiB
01_handmade_10.txt WA 32 ms 3572 KiB
01_handmade_11.txt WA 33 ms 3576 KiB
01_handmade_12.txt WA 33 ms 3524 KiB
01_handmade_13.txt WA 38 ms 4264 KiB
01_handmade_14.txt WA 38 ms 4272 KiB
01_handmade_15.txt AC 42 ms 4524 KiB
02_random_00.txt WA 44 ms 4260 KiB
02_random_01.txt WA 43 ms 4260 KiB
02_random_02.txt WA 44 ms 4268 KiB
02_random_03.txt WA 44 ms 4264 KiB
02_random_04.txt WA 41 ms 4264 KiB
02_random_05.txt WA 41 ms 4264 KiB
02_random_06.txt WA 41 ms 4264 KiB
02_random_07.txt WA 41 ms 4264 KiB
02_random_08.txt AC 43 ms 4264 KiB
02_random_09.txt WA 44 ms 4272 KiB
02_random_10.txt WA 44 ms 4264 KiB
02_random_11.txt WA 45 ms 4272 KiB
02_random_12.txt WA 44 ms 4264 KiB
02_random_13.txt WA 44 ms 4264 KiB
02_random_14.txt WA 44 ms 4264 KiB
02_random_15.txt WA 44 ms 4264 KiB