結果

問題 No.1465 Archaea
ユーザー snow39snow39
提出日時 2021-04-02 22:14:26
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 1,216 bytes
コンパイル時間 1,285 ms
コンパイル使用メモリ 105,768 KB
実行使用メモリ 4,584 KB
最終ジャッジ日時 2023-08-25 16:17:13
合計ジャッジ時間 2,308 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 8 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 16 ms
4,404 KB
testcase_14 AC 7 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 15 ms
4,380 KB
testcase_18 AC 3 ms
4,384 KB
testcase_19 AC 8 ms
4,376 KB
testcase_20 AC 11 ms
4,380 KB
testcase_21 AC 19 ms
4,568 KB
testcase_22 AC 19 ms
4,584 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const int F=20;
const int INF=1e9;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N,K;
  cin>>N>>K;

  vector<int> dp(N+1,INF);
  dp[1]=0;
  for(int k=0;k<F;k++){
      vector<int> ndp=dp;
      for(int j=0;j<3;j++){
          int value=INF;
          for(int i=j;i<=N;i+=3){
              chmin(ndp[i],value);

              chmin(value,dp[i]);
              if(value<INF) value++;
          }
      }

      for(int i=1;i<=N;i++){
          int value=i;
          int cnt=0;
          while(value*2<=N){
              value*=2;
              cnt++;
              chmin(ndp[value],dp[i]+cnt);
          }
      }
      swap(dp,ndp);
  }

  if(dp[N]<=K) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}
0