結果
問題 | No.1298 OR XOR |
ユーザー |
|
提出日時 | 2020-11-29 06:32:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 953 bytes |
コンパイル時間 | 1,653 ms |
コンパイル使用メモリ | 167,580 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 01:52:48 |
合計ジャッジ時間 | 2,273 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h>#define REP(i,n) for (int i = 0; i < (n); ++i)template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}using namespace std;using ll = long long;using P = pair<int,int>;using Pl = pair<long long,long long>;using veci = vector<int>;using vecl = vector<long>;using vecveci = vector<vector<int>>;using vecvecl = vector<vector<long long>>;int main() {ll n; cin >> n;ll a = 0,b = 0,c = 0;int cnt = 0;if(__builtin_popcount(n) == 1) cout << -1 <<" " << -1 << " " << -1 << endl;else {for(int i = 0; i < 30; i++) {if(n & (1 << i)) {if(cnt%2 == 0) a |= (1<<i), c |= (1 << i);else b |= (1<<i), c |= (1 << i);cnt++;}}cout << a << " " << b << " " << c << endl;}}