結果
問題 |
No.683 Two Operations No.3
|
ユーザー |
![]() |
提出日時 | 2018-05-11 22:56:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 647 bytes |
コンパイル時間 | 1,664 ms |
コンパイル使用メモリ | 173,432 KB |
実行使用メモリ | 127,752 KB |
最終ジャッジ日時 | 2024-06-28 08:56:59 |
合計ジャッジ時間 | 5,539 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 TLE * 1 -- * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b; cin >> a >> b; stack<pair<int64_t, int64_t>> st; st.push({a, b}); while (!st.empty()) { int64_t x = st.top().first, y = st.top().second; st.pop(); if (x < 0 || y < 0) { continue; } if (x == 0 && y == 0) { cout << "Yes" << endl; return 0; } if (x % 2 == 0) { st.push({x / 2, y - 1}); } if (y % 2 == 0) { st.push({x - 1, y / 2}); } } cout << "No" << endl; return 0; }