結果

問題 No.474 色塗り2
ユーザー vjudge1
提出日時 2025-06-22 11:30:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 61,764 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-22 11:30:30
合計ジャッジ時間 1,572 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

bool is_odd_comb(int n, int k) {
    return (n & k) == k;
}

int solve(int A, int B, int C) {
    if (C % 2 == 0) {
        return 0;
    }
    bool cond1 = is_odd_comb(C + A - 1, A);
    bool cond2 = is_odd_comb(C + B - 1, B);
    return cond1 && cond2 ? 1 : 0;
}

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

    int T;
    cin >> T;
    while (T--) {
        int A, B, C;
        cin >> A >> B >> C;
        cout << solve(A, B, C) << "\n";
    }
    return 0;
}
0