結果

問題 No.683 Two Operations No.3
コンテスト
ユーザー xxxasdfghjk
提出日時 2018-08-13 14:35:55
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 814 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 584 ms
コンパイル使用メモリ 95,236 KB
実行使用メモリ 1,303,296 KB
最終ジャッジ日時 2026-04-11 14:37:01
合計ジャッジ時間 2,349 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 MLE * 2 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;

bool solve(ll A,ll B){
  if(A == 0 && B == 0)
    return true;
  else if(A % 2 == 1 && B % 2 == 1)
    return false;
  else{
    if(A % 2 == 0 && B % 2 == 0){
      return solve(A/2,B-1) || solve(A-1,B/2);
    }else{
      if(A % 2 == 1)
        return solve(A-1,B/2);
      else
        return solve(A/2,B-1);
    }
  }
  
}

int main()
{
  ll A,B;
  cin >> A >> B;
  if(solve(A,B)){
    cout << "Yes" << endl;
  }else
    cout << "No" << endl;
  return 0;
}

0