結果
| 問題 | No.1465 Archaea | 
| コンテスト | |
| ユーザー |  Nachia | 
| 提出日時 | 2021-04-02 22:11:34 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 513 bytes | 
| コンパイル時間 | 1,909 ms | 
| コンパイル使用メモリ | 197,812 KB | 
| 最終ジャッジ日時 | 2025-01-20 09:25:01 | 
| ジャッジサーバーID (参考情報) | judge3 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 20 | 
ソースコード
#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(N+1,-1);
  queue<int> Q;
  D[1]=0; Q.push(1);
  while(Q.size()){
    int p=Q.front(); Q.pop();
    if(D[p]==K) continue;
    if(p*2<=N) if(D[p*2]==-1){ D[p*2]=D[p]+1; Q.push(p*2); }
    if(p+3<=N) if(D[p+3]==-1){ D[p+3]=D[p]+1; Q.push(p+3); }
  }
  if(D[N]==-1) cout<<"NO\n";
  else cout<<"YES\n";
  return 0;
}
            
            
            
        