結果

問題 No.3088 XOR = SUM
ユーザー yu23578
提出日時 2025-04-04 23:04:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 193,124 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-04 23:04:59
合計ジャッジ時間 17,978 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 2 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long

int T;

signed main(){
  cin>>T;
  for(int i = 0; i < T; i++){
    int N; cin>>N;
    int cnt = 1;
    for(int i = 0; cnt*2 < N; i++){
      cnt *= 2;
    }
    int S = N;
    if(cnt * 2 == N) S = N-1;
    int x0 = cnt;
    int y0 = S-cnt;
    int a0 = x0*y0;
    int x1 = cnt/2;
    int y1 = cnt/2-1;
    int a1 = x1*y1;
    if(N == 0) cout << "0 0" << endl;
    else if(N == 1) cout << "1 0" << endl;
    else if(N == 2) cout << "2 0" << endl;
    else if(a0 >= a1) cout << x0 << " " << y0 << endl;
    else cout << x1 << " " << y1 << endl;
  }
}
0