結果

問題 No.683 Two Operations No.3
ユーザー BantakoBantako
提出日時 2018-06-06 19:16:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 1,629 ms
コンパイル使用メモリ 163,320 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-12 22:47:30
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,500 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:16:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   16 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
bool dfs(ll X,ll Y){
    //cout << X << " " << Y << endl;
    if(X == 0 || Y == 0)    return 1;
    bool ans = 0;
    if(X % 2 == 0 && Y >= 1)ans |= dfs(X / 2,Y - 1);
    if(Y % 2 == 0 && X >= 1)ans |= dfs(X - 1, Y / 2);

    return ans;
}
main(){
    ll X,Y;
    cin >> X >> Y;
    if(dfs(X,Y))cout << "Yes" << endl;
    else cout << "No" << endl;
}
0