結果

問題 No.683 Two Operations No.3
ユーザー そすうぽよそすうぽよ
提出日時 2020-01-27 23:49:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 2,394 ms
コンパイル使用メモリ 191,336 KB
最終ジャッジ日時 2025-01-08 20:41:23
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

bool ok(ll a, ll b) {
  if (min(a,b) == 0) return true;
  if (a%2 == 0) {
    if (ok(a/2, b-1)) return true;
  }
  if (b%2 == 0) {
    if (ok(a-1, b/2)) return true;
  }
  return false;
}

int main()
{
  ll a,b;
  cin>>a>>b;
  auto ans = ok(a,b);
  if(ans) {
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}
0