結果

問題 No.1465 Archaea
ユーザー 👑 Nachia
提出日時 2021-04-02 22:09:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 197,828 KB
最終ジャッジ日時 2025-01-20 09:23:39
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 6 WA * 9 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N,K;
vector<int> D;

int main(){
  cin>>N>>K;
  D.assign(K+1,-1);
  queue<int> Q;
  D[1]=0; Q.push(1);
  while(Q.size()){
    int p=Q.front(); Q.pop();
    if(D[p*2]==-1){ D[p*2]=D[p]+1; Q.push(p*2); }
    if(D[p+3]==-1){ D[p+3]=D[p]+1; Q.push(p+3); }
  }
  if(D[K]==-1) cout<<"NO\n";
  else cout<<"YES\n";
  return 0;
}
0