結果

問題 No.1465 Archaea
ユーザー polyesterpolyester
提出日時 2021-04-02 22:41:32
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 731 bytes
コンパイル時間 2,318 ms
コンパイル使用メモリ 103,116 KB
実行使用メモリ 12,068 KB
最終ジャッジ日時 2023-08-25 16:19:05
合計ジャッジ時間 3,617 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 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 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 4 ms
5,176 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 5 ms
6,568 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 5 ms
5,716 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 10 ms
9,940 KB
testcase_14 AC 5 ms
6,016 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 9 ms
10,168 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,644 KB
testcase_20 AC 4 ms
7,112 KB
testcase_21 AC 12 ms
12,068 KB
testcase_22 AC 11 ms
11,984 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n, k;
  cin >> n >> k;
  vector<vector<int>> dp(n + 10);
  dp[1].push_back(0);
  for(int i = 1; i < n; i++) {
    if(dp[i].size() == 0) {
      continue;
    }
    int tmp = *min_element(dp[i].begin(), dp[i].end());
    if(tmp >= k) {
      continue;
    }
    dp[i + 3].push_back(tmp + 1);
    if(i * 2 <= n) {
      dp[i * 2].push_back(tmp + 1);
    }
  }
  if(dp[n].size() > 0) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}
0