結果
問題 | No.1298 OR XOR |
ユーザー |
|
提出日時 | 2024-08-06 23:55:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 1,508 ms |
コンパイル使用メモリ | 168,752 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-06 23:55:50 |
合計ジャッジ時間 | 2,531 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int64_t inf = 1e18; const int64_t mod = 998244353; // const int64_t mod = 1000000007; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> ans(4, -1); if (__builtin_popcount(n) >= 2) { int cnt = 0; ans.assign(4, 0); for (int i = 0; i <= 30; i++) { if (n >> i & 1) { for (int j = 0; j < 3; j++) { if (j == cnt) continue; else ans[j] |= 1<<i; } cnt++; cnt %= 3; } } } for (int i = 0; i <3; i++) cout << ans[i] << " "; cout << endl; }