結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
yukarinoki
|
| 提出日時 | 2018-05-11 23:57:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 637 bytes |
| コンパイル時間 | 559 ms |
| コンパイル使用メモリ | 67,328 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-06-28 09:07:32 |
| 合計ジャッジ時間 | 4,317 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 1 -- * 9 |
ソースコード
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
ll a, b;
cin >> a >> b;
queue<pair<ll,ll> > q;
if(a<b) swap(a,b);
q.push(make_pair(a,b));
bool flag = false;
while(!q.empty()){
ll x = q.front().first, y = q.front().second;
q.pop();
if(x<y) swap(x,y);
if(x==0&&y==0){flag=true; break;}
if(x % 2 == 0 && y>0) q.push(make_pair(y-1,x/2));
if(y % 2 == 0 && x>0) q.push(make_pair(x-1,y/2));
}
if(flag) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
yukarinoki