結果
| 問題 |
No.3088 XOR = SUM
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 14:46:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 634 bytes |
| コンパイル時間 | 2,282 ms |
| コンパイル使用メモリ | 192,136 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-20 14:46:22 |
| 合計ジャッジ時間 | 16,498 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 WA * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
ll n;
cin >> n;
if (n == 0) {
cout << "0 0\n";
return;
}
ll x = (1ll << (63 - __builtin_clzll(n)));
if (n == x) {
cout << x << ' ' << n - x << '\n';
return;
}
ll y = (1ll << (63 - __builtin_clzll(n ^ x)));
if ((y << 2) >= x) cout << x << ' ' << n - x << '\n';
else {
y = x >> 1;
cout << y << ' ' << y - 1 << '\n';
}
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int q;
cin >> q;
while (q--) {
solve();
}
return 0;
}