結果

問題 No.1465 Archaea
ユーザー DaYuanChiDaYuanChi
提出日時 2021-04-02 22:27:08
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 3,979 ms
コンパイル使用メモリ 174,236 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 12:37:56
合計ジャッジ時間 4,087 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,384 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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] = 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