結果

問題 No.1298 OR XOR
ユーザー Kalyan GandhapuKalyan Gandhapu
提出日時 2020-11-27 22:19:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,962 bytes
コンパイル時間 2,238 ms
コンパイル使用メモリ 199,984 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-01 06:30:57
合計ジャッジ時間 3,734 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘void solve()’ 内:
main.cpp:4:14: 警告: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
    4 | #define endl '\n'
      |              ^~~~
main.cpp:40:15: 備考: ‘c’ はここで定義されています
   40 |         int b,c;
      |               ^
main.cpp:55:34: 警告: ‘b’ may be used uninitialized [-Wmaybe-uninitialized]
   55 |         cout << n << " " << b << " " << c << endl;
      |                                  ^~~
main.cpp:40:13: 備考: ‘b’ はここで定義されています
   40 |         int b,c;
      |             ^

ソースコード

diff #

// 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){
    	int b,c;
    	bool ok = false;
    	for(int i = 31; i >= 0; i--){
    		int k = n >> i;
    		if(k&1){
    			if(!ok){
    				b = pow(2,i);
    				ok = true;
    			}
    			else{
    				c = pow(2,i);
    				break;
    			}
    		}
    	}
    	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;
}
0