結果

問題 No.1465 Archaea
ユーザー kappybar
提出日時 2021-04-02 22:02:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 829 bytes
コンパイル時間 1,656 ms
コンパイル使用メモリ 173,676 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2024-12-24 01:18:43
合計ジャッジ時間 2,434 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y))
#define chmax(x,y) x = max((x),(y))
#define popcount(x) __builtin_popcount(x)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
//const int MOD = 1000000007;
const int MOD = 998244353;
const double PI = 3.14159265358979323846;

map<int,int> memo;

int dfs(int x){
    if(x < 1) return INF;
    if(x == 1) return 0;
    if(x == 3) return INF;
    if(memo.count(x) > 0) return memo[x];
    int res = INF;
    if(x % 2 == 0) res = dfs(x/2)+1;
    else res = dfs(x-3)+1;
    memo[x] = res;
    return res;
}

int main(){
    int n,k;
    cin >> n >> k;
    cout << (dfs(n) <= k ? "YES" : "NO") << endl;
    return 0;
}
0