結果

問題 No.1465 Archaea
ユーザー rrtarrta
提出日時 2021-04-05 02:13:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 614 bytes
コンパイル時間 1,518 ms
コンパイル使用メモリ 172,924 KB
実行使用メモリ 15,756 KB
最終ジャッジ日時 2023-08-28 13:36:51
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 RE -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 7 ms
5,940 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 10 ms
7,744 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 9 ms
6,972 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 19 ms
12,496 KB
testcase_14 AC 9 ms
6,976 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 19 ms
13,124 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 10 ms
7,532 KB
testcase_20 AC 14 ms
10,344 KB
testcase_21 AC 22 ms
15,576 KB
testcase_22 AC 23 ms
15,756 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll INF=1000000000000000;
using Graph=vector<vector<ll>>;
ll N,K;
ll d[200005];
void bfs(const Graph &G,ll s){
fill(d,d+N+1,INF);d[s]=0;
  queue<ll>que;que.push(s);
  while(!que.empty()){
  ll v=que.front();que.pop();
    for(auto u:G[v]){
    if(d[u]!=INF)continue;
      d[u]=d[v]+1;que.push(u);
    }
  }
}
int main(){
 cin>>N>>K;
  Graph G(N+1);G[2].push_back(1);
  for(ll i=3;i<=N;i++){
  G[i].push_back(i-3);
    if(i%2==0)G[i].push_back(i/2);
  }bfs(G,N);
  if(d[1]<=K)cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}
0