結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
どらら
|
| 提出日時 | 2018-05-12 00:32:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,020 bytes |
| コンパイル時間 | 1,686 ms |
| コンパイル使用メモリ | 168,108 KB |
| 実行使用メモリ | 13,760 KB |
| 最終ジャッジ日時 | 2024-06-28 09:22:14 |
| 合計ジャッジ時間 | 5,364 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 TLE * 1 -- * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
bool check(ll A, ll B){
if(A == 0 && B == 0) return true;
if(A < 0 || B < 0) return false;
if(A > B){
if(A%2==0 && B>0){
if(check(A/2,B-1)) return true;
}
if(B%2==0 && A>0){
if(check(A-1,B/2)) return true;
}
}else{
if(B%2==0 && A>0){
if(check(A-1,B/2)) return true;
}
if(A%2==0 && B>0){
if(check(A/2,B-1)) return true;
}
}
return false;
}
int main(){
ll A, B;
cin >> A >> B;
if(A > B) swap(A,B);
if(A==0){
cout << "Yes" << endl;
return 0;
}
if(A==1){
if(B%2==0) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
if(check(A,B)) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
どらら