結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
NaruY
|
| 提出日時 | 2018-05-17 14:05:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,254 bytes |
| コンパイル時間 | 1,645 ms |
| コンパイル使用メモリ | 171,032 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-06-28 13:28:30 |
| 合計ジャッジ時間 | 5,250 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 1 -- * 9 |
ソースコード
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int main(){
ll A,B;
scanf("%lld %lld",&A,&B);
queue<pair<ll,ll> >Q;
Q.push(MP(A,B));
while(!Q.empty()){
pair<ll,ll> ab = Q.front(); Q.pop();
ll a = ab.fst;
ll b = ab.snd;
if ((a<0) or (b<0)) continue;
if ((a==0) and (b==0)){
printf("Yes\n");
return 0;
}
if ((a%2 == 1) and (b%2 == 1)){
} else if (a%2 == 1){
Q.push(MP(a-1,b/2));
} else if (b%2 == 1){
Q.push(MP(a/2,b-1));
}else{
Q.push(MP(a-1,b/2));
Q.push(MP(a/2,b-1));
}
}
printf("No\n");
return 0;
}
NaruY