結果

問題 No.2103 ±1s Game
ユーザー hitonanode
提出日時 2022-09-05 09:05:38
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 769 bytes
コンパイル時間 7,624 ms
コンパイル使用メモリ 265,004 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-20 08:25:07
合計ジャッジ時間 7,780 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "testlib.h"

#include <cassert>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int MAXI = 1000000000;

vector<string> ret{"Bob", "Alice"};

int main(int argc, char *argv[]) {
    registerValidation(argc, argv);
    int X = inf.readInt(1, MAXI);
    inf.readSpace();
    int Y = inf.readInt(1, MAXI);
    inf.readSpace();
    int K = inf.readInt(1, X + Y - 1);
    inf.readSpace();
    int P = inf.readInt(-1, 1);
    assert(abs(P) == 1);
    inf.readEoln();
    inf.readEof();

    int D = X + Y - K;
    int parity = P < 0;

    if (X <= D / 2) {
        cout << ret.at(!parity ^ (K % 2)) << endl;
    } else if (Y <= D / 2) {
        cout << ret.at(!parity) << endl;
    } else {
        cout << ret.at(D % 2) << endl;
    }
}
0