結果
| 問題 |
No.1298 OR XOR
|
| コンテスト | |
| ユーザー |
altair_kyopro
|
| 提出日時 | 2020-11-27 21:43:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,223 bytes |
| コンパイル時間 | 1,504 ms |
| コンパイル使用メモリ | 167,916 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-26 12:04:42 |
| 合計ジャッジ時間 | 2,182 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;
template<class T> bool chmin(T &a, T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b){a=b;return 1;}return 0;}
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n;
cin >> n;
bitset<32> bit(n);
ll count = 0;
for (ll i = 0; i < 31; i++){
if (bit.test(i)){
count++;
}
}
if (count <= 1){
cout << -1 << " " << -1 << " " << -1 << endl;
return 0;
}
ll a = 0,b = 0,c = 0;
ll t = 1;
bool x = true;
for (ll i = 0; i < 31; i++){
if (bit.test(i)){
a += t;
if (x) b += t;
else c += t;
x = !x;
}
t *= 2;
}
cout << a << " " << b << " " << c << endl;
}
altair_kyopro