結果
| 問題 | No.683 Two Operations No.3 | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2019-06-05 09:31:36 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 1,109 bytes | 
| コンパイル時間 | 671 ms | 
| コンパイル使用メモリ | 76,140 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-19 18:36:01 | 
| 合計ジャッジ時間 | 1,319 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 | 
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <iomanip>
#include <numeric>
#define L64 long long
#define UL64 unsigned long long
#define MOD (1000000007LL)
struct task{
    task(L64 a, L64 b) : a(a), b(b){}
    L64 a;
    L64 b;
};
int main(void)
{
  L64 a, b;
  std::cin >> a >> b;
  std::vector<task> tasks;
  int tasknum = 1;
  int done = 0;
  bool found = false;
  tasks.push_back(task(a, b));
  while(done < tasknum){
    L64 ta = tasks[done].a;
    L64 tb = tasks[done].b;
    if(ta == 0 || tb == 0){
        found = true;
        break;
    }
    if(ta % 2 == 0){
      tasks.push_back(task(ta / 2, tb - 1LL));
      tasknum++;
      if (tb % 4 == 0) {
        tasks.push_back(task(ta - 2LL, tb / 4));
        tasknum++;
      }
    } else {
      if (tb % 2 == 0) {
        tasks.push_back(task(ta - 1LL, tb / 2));
       tasknum++;
       }
    }
    done++;
  }
  if(found){
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
}
            
            
            
        