結果
問題 | No.1298 OR XOR |
ユーザー |
|
提出日時 | 2021-01-08 01:20:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 1,573 ms |
コンパイル使用メモリ | 171,996 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 07:26:58 |
合計ジャッジ時間 | 2,502 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;constexpr char newl = '\n';int main() {cin.tie(nullptr);ios::sync_with_stdio(false);ll n;cin >> n;vector<ll> ans(3, 0);int tar = 0;for (int i = 30; i >= 0; i--) {if (n >> i & 1) {for (int j = 0; j < 3; j++) {if (j == tar) continue;ans[j] |= (1LL << i);}tar = (tar + 1) % 3;}}sort(ans.begin(), ans.end());if (ans[0] == 0) {cout << "-1 -1 -1\n";} else {cout << ans[0] << " " << ans[1] << " " << ans[2] << newl;}return 0;}