結果
| 問題 |
No.1298 OR XOR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-27 21:51:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 601 bytes |
| コンパイル時間 | 777 ms |
| コンパイル使用メモリ | 71,636 KB |
| 最終ジャッジ日時 | 2025-01-16 06:58:25 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> ans(3, 0);
int s = 0;
for (int i = 0; i < 30; ++i) {
if ((~n >> i) & 1) continue;
for (int j = 0; j < 3; ++j) {
if (j != s) ans[j] |= (1 << i);
}
(++s) %= 3;
}
for (auto x : ans) {
if (x == 0) {
for (auto& y : ans) y = -1;
}
}
for (auto x : ans) cout << x << " ";
cout << "\n";
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
solve();
return 0;
}