結果

問題 No.1465 Archaea
ユーザー snow39snow39
提出日時 2021-04-02 22:14:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,216 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 105,880 KB
実行使用メモリ 4,700 KB
最終ジャッジ日時 2023-08-25 12:26:35
合計ジャッジ時間 2,076 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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]=1;
  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