結果

問題 No.1298 OR XOR
コンテスト
ユーザー ldsyb
提出日時 2026-09-12 01:49:31
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 759 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,076 ms
コンパイル使用メモリ 376,032 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2026-09-12 01:50:11
合計ジャッジ時間 25,204 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

int main() {
    const auto start = steady_clock::now();

    random_device rnd;
    mt19937 engine(rnd());

    int64_t n;
    cin >> n;

    uniform_int_distribution<> randn(1, n);

    while (duration_cast<milliseconds>(steady_clock::now() - start).count() <
           1900) {
        int64_t a = randn(engine), b = randn(engine);
        int64_t c = a ^ b;

        if (1 <= c && (a | b) == (b | c) && (b | c) == (c | a) &&
            (c | a) == n) {
            cout << a << ' ' << b << ' ' << c << endl;
            return 0;
        }
    }

    cout << "-1 -1 -1" << endl;

    return 0;
}
0