結果
問題 | No.1298 OR XOR |
ユーザー | IKyopro |
提出日時 | 2020-12-02 20:29:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 899 bytes |
コンパイル時間 | 1,702 ms |
コンパイル使用メモリ | 195,412 KB |
最終ジャッジ日時 | 2025-01-16 13:32:10 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T> using vec = vector<T>; template <class T> using vvec = vector<vec<T>>; template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;} template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;} #define rep(i,n) for(int i=0;i<(n);i++) #define drep(i,n) for(int i=(n)-1;i>=0;i--) #define all(x) (x).begin(),(x).end() #define debug(x) cerr << #x << " = " << (x) << endl; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vec<int> bit; rep(i,30) if(N>>i&1) bit.push_back(i); if(bit.size()<2){ cout << "-1 -1 -1\n"; return 0; } vec<int> res(3); rep(i,bit.size()){ res[i%2] += 1<<bit[i]; res[2] += 1<<bit[i]; } cout << res[0] << " " << res[1] << " " << res[2] << "\n"; }