結果
| 問題 |
No.1298 OR XOR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-27 23:04:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,025 bytes |
| コンパイル時間 | 2,208 ms |
| コンパイル使用メモリ | 193,988 KB |
| 最終ジャッジ日時 | 2025-01-16 08:20:29 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 WA * 3 |
ソースコード
// author : kalyan
#include "bits/stdc++.h"
#define ll long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
void solve(){
int n;
cin >> n;
int cnt = __builtin_popcount(n);
debug(cnt);
if(cnt%2 == 0){
int b = 0,c = 0;
bool ok = false;
int count = 0;
for(int i = 31; i >= 0; i--){
int k = n >> i;
if(k&1){
if(!ok){
count++;
b += pow(2,i);
if(count == cnt/2)
ok = true;
}
else{
c += pow(2,i);
}
}
}
cout << n << " " << b << " " << c << endl;
}
else{
cout << "-1 -1 -1\n";
}
}
int main(){
fastio;
ll t;
t = 1;
// cin >> t;
// ll i = 1;
while(t--){
// cout << "Case #" << i << ": ";
solve();
// i++;
}
return 0;
}