結果
問題 |
No.3088 XOR = SUM
|
ユーザー |
![]() |
提出日時 | 2025-04-04 22:55:15 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 941 bytes |
コンパイル時間 | 5,573 ms |
コンパイル使用メモリ | 331,544 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-04-04 22:55:29 |
合計ジャッジ時間 | 14,175 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 21 |
ソースコード
#include <atcoder/all> #include <bits/stdc++.h> #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { ll n; cin >> n; if (n == 0) { cout << "0 0\n"; continue; } ll a = 0, b = 0; int p = 0; rep(i, 0, 62) { if (n & (1LL << i)) { p = i; } } ll m = 1LL << p; a = m; b = n ^ m; if (a > b) swap(a, b); if (p >= 1) { ll na = 1LL << (p - 1); ll nb = na - 1; if (na > nb) swap(na, nb); if (a < na) { a = na; b = nb; } } cout << a << ' ' << b << '\n'; } }