結果
問題 |
No.683 Two Operations No.3
|
ユーザー |
![]() |
提出日時 | 2020-09-03 11:27:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 961 bytes |
コンパイル時間 | 892 ms |
コンパイル使用メモリ | 83,632 KB |
実行使用メモリ | 818,176 KB |
最終ジャッジ日時 | 2024-11-23 00:58:24 |
合計ジャッジ時間 | 10,568 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 MLE * 6 |
コンパイルメッセージ
main.cpp: In function 'bool dfs(ll, ll)': main.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type] 48 | } | ^
ソースコード
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<utility> #include<map> #include<set> #include<queue> #include<stack> #include<functional> #include<math.h> using namespace std; //#define N (1000000000+7) //#define N (998244353) #define N 17 #define INF 1e16 typedef long long ll; typedef pair<ll,ll> P; typedef vector<ll> vec; typedef vector<vec> mat; const int inf = 1e9; bool dfs(ll A,ll B){ if(A<0){ return false; } if(B<0){ return false; } if(A==0 && B==0){ return true; } if(A%2==1 && B%2==1){ return false; } if(A%2==0 && B%2==1){ return dfs(A/2,B-1); } if(A%2==1 && B%2==0){ return dfs(A-1,B/2); } if(A%2==0 && B%2==0){ ll t1 = dfs(A-1,B/2); ll t2 = dfs(A/2,B-1); return t1|t2; } } int main(void){ ll A,B; cin>>A>>B; if(dfs(A,B))cout<<"Yes"<<endl; else cout<<"No"<<endl; }