結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-11 22:44:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 575 ms |
| コンパイル使用メモリ | 70,064 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 08:51:21 |
| 合計ジャッジ時間 | 1,253 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 6 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int msb(long long n) {
for (int i = 60; i >= 0; i--) {
if (n >> i & 1) return i;
}
return -1;
}
bool f(long long a, long long b) {
int c = 0;
long long x = 1;
long long y = 0;
long long z = 2;
for (int i = msb(a) - 1; i >= 0; i--) {
y++;
if (a >> i & 1) {
y *= 2;
z *= 2;
x++;
}
}
return (b - y) % z == 0 && b >= y;
}
int main() {
long long a, b;
cin >> a >> b;
if (a == 0 || b == 0 || f(a, b) || f(b, a)) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}