結果
| 問題 | No.3088 XOR = SUM |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-04-08 15:21:54 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 124 ms / 2,000 ms |
| コード長 | 669 bytes |
| 記録 | |
| コンパイル時間 | 236 ms |
| コンパイル使用メモリ | 68,548 KB |
| 実行使用メモリ | 5,760 KB |
| 最終ジャッジ日時 | 2026-07-08 13:43:00 |
| 合計ジャッジ時間 | 15,183 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3088.cc: No.3088 XOR = SUM - yukicoder
*/
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
using ll = long long;
/* global variables */
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
ll n;
scanf("%lld", &n);
if (n == 0) { puts("0 0"); continue; }
ll msb = 1;
while ((msb << 1) <= n) msb <<= 1;
ll x = msb, y = n ^ msb;
if (x > 1) {
ll x0 = (x >> 1), y0 = x0 - 1;
if (logl(x) + logl(y) < logl(x0) + logl(y0))
x = x0, y = y0;
}
printf("%lld %lld\n", x, y);
}
return 0;
}
tnakao0123