結果

問題 No.1465 Archaea
ユーザー DaYuanChiDaYuanChi
提出日時 2021-04-02 22:37:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 1,347 ms
コンパイル使用メモリ 174,992 KB
実行使用メモリ 13,528 KB
最終ジャッジ日時 2023-08-25 12:49:33
合計ジャッジ時間 2,473 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 10 ms
5,788 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 11 ms
5,824 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 12 ms
6,464 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 32 ms
11,012 KB
testcase_14 AC 10 ms
5,716 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 37 ms
11,404 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 20 ms
7,288 KB
testcase_21 AC 45 ms
13,456 KB
testcase_22 AC 45 ms
13,528 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘ll solve(ll)’ 内:
main.cpp:13:1: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   13 | }
      | ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
map<ll, ll> memo;
 
ll solve(ll y){
  if(memo.find(y) != memo.end()) return memo[y];
  if(y==1) return memo[1] = 0;
  if(y%2==1 && y!=3) return memo[y] = min(solve(y-3),solve((y-3)/2)+2);
  if(y%2==0) return memo[y] = min(solve(y-3),solve(y/2)+1);
  if(y==3) return memo[y] = 1e9;
}
 
int main(){
  int x, k; cin >> x >> k;
  int m = solve(x);
  if(m<=k) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}
  
0