結果

問題 No.1298 OR XOR
ユーザー altair_kyoproaltair_kyopro
提出日時 2020-11-27 21:39:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,211 bytes
コンパイル時間 1,457 ms
コンパイル使用メモリ 166,072 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-01 05:07:24
合計ジャッジ時間 3,406 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 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 -
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/istream:39,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/sstream:38,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/complex:45,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/ccomplex:39,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/stdc++.h:54,
         次から読み込み:  main.cpp:2:
メンバ関数 ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’ 内,
    inlined from ‘int main()’ at main.cpp:56:37:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:42:12: 備考: ‘c’ はここで定義されています
   42 |     ll a,b,c;
      |            ^
main.cpp:49:22: 警告: ‘b’ may be used uninitialized [-Wmaybe-uninitialized]
   49 |             if (x) b += t;
      |                    ~~^~~~
main.cpp:42:10: 備考: ‘b’ はここで定義されています
   42 |     ll a,b,c;
      |          ^
main.cpp:48:15: 警告: ‘a’ may be used uninitialized [-Wmaybe-uninitialized]
   48 |             a += t;
      |             ~~^~~~
main.cpp:42:8: 備考: ‘a’ はここで定義されています
   42 |     ll a,b,c;
      |        ^

ソースコード

diff #

#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,b,c;
    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;
}
0