結果

問題 No.1242 高橋君とすごろく
ユーザー 👑 emthrmemthrm
提出日時 2020-10-02 21:57:32
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,482 bytes
コンパイル時間 1,897 ms
コンパイル使用メモリ 203,152 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-24 12:13:41
合計ジャッジ時間 4,116 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
constexpr int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  ll n; int k; cin >> n >> k;
  vector<ll> a(k); REP(i, k) cin >> a[i];
  REP(i, k - 1) {
    if (a[i] >= 10000 && a[i + 1] - a[i] <= 5) {
      assert(false);
      cout << "No\n";
      return 0;
    }
  }
  int x = min(n, 20000LL);
  vector<bool> ng(x + 1, false);
  REP(i, k) {
    if (a[i] <= x) ng[a[i]] = true;
  }
  for (int i = x - 1; i >= 1; --i) {
    if (i + 6 <= x && ng[i + 1] && ng[i + 6]) ng[i] = true;
    if (i + 5 <= x && ng[i + 2] && ng[i + 5]) ng[i] = true;
    if (i + 4 <= x && ng[i + 3] && ng[i + 4]) ng[i] = true;
  }
  cout << (ng[1] ? "No\n" : "Yes\n");
  return 0;
}
0