結果

問題 No.1298 OR XOR
ユーザー planesplanes
提出日時 2022-07-29 20:22:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 1,523 ms
コンパイル使用メモリ 166,088 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 11:12:30
合計ジャッジ時間 3,869 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
                 from main.cpp:1:
In member function '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:20:22:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'B' may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:10:8: note: 'B' was declared here
   10 |   ll A,B,C;
      |        ^
main.cpp:15:13: warning: 'C' may be used uninitialized [-Wmaybe-uninitialized]
   15 |       else C+=(1LL<<k);
      |            ~^~~~~~~~~~
main.cpp:10:10: note: 'C' was declared here
   10 |   ll A,B,C;
      |          ^

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)

int main() {
  ll N;cin>>N;
  ll A,B,C;
  A=N;
  for(ll k=0;k<=30;k++) {
    if(N&(1LL<<k)){
      if(B==0) B+=(1LL<<k);
      else C+=(1LL<<k);
    }
  }

  if(C==0) cout<<-1<<" "<<-1<<" "<<-1<<endl;
  else cout<<A<<" "<<B<<" "<<C<<endl;
}

    



  


  
0