結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー random contestantrandom contestant
提出日時 2023-08-04 22:00:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 880 bytes
コンパイル時間 4,088 ms
コンパイル使用メモリ 260,120 KB
実行使用メモリ 7,864 KB
最終ジャッジ日時 2023-08-23 01:43:39
合計ジャッジ時間 5,656 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,368 KB
testcase_01 AC 3 ms
6,124 KB
testcase_02 AC 4 ms
6,316 KB
testcase_03 AC 26 ms
6,780 KB
testcase_04 AC 5 ms
6,252 KB
testcase_05 AC 40 ms
7,700 KB
testcase_06 AC 14 ms
6,712 KB
testcase_07 AC 7 ms
6,560 KB
testcase_08 AC 8 ms
6,508 KB
testcase_09 AC 13 ms
6,840 KB
testcase_10 AC 23 ms
6,964 KB
testcase_11 AC 15 ms
6,644 KB
testcase_12 AC 8 ms
6,388 KB
testcase_13 AC 4 ms
6,980 KB
testcase_14 AC 5 ms
7,864 KB
testcase_15 AC 5 ms
7,140 KB
testcase_16 AC 3 ms
6,456 KB
testcase_17 AC 4 ms
7,364 KB
testcase_18 AC 5 ms
7,048 KB
testcase_19 AC 5 ms
7,444 KB
testcase_20 AC 5 ms
7,356 KB
testcase_21 AC 3 ms
6,240 KB
testcase_22 AC 3 ms
6,660 KB
testcase_23 AC 3 ms
6,720 KB
testcase_24 AC 4 ms
6,708 KB
testcase_25 AC 5 ms
7,492 KB
testcase_26 AC 5 ms
6,776 KB
testcase_27 AC 5 ms
7,524 KB
testcase_28 AC 5 ms
6,976 KB
testcase_29 AC 5 ms
6,776 KB
testcase_30 AC 3 ms
6,240 KB
testcase_31 AC 5 ms
7,600 KB
testcase_32 AC 3 ms
6,892 KB
testcase_33 AC 4 ms
6,188 KB
testcase_34 AC 4 ms
6,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<ll,ll>;
#define pb push_back
#define int long long
#define double long double
#define INF (ll) 3e18
// Ctrl + Shift + B コンパイル
// Ctrl + C 中断
// ./m 実行


signed main(){
  int n; cin >> n;
  int k; cin >> k;
  int m; cin >> m;
  vl s(n+1);
  rep(_,m) {
    int x; cin >> x;
    s[x] = 1;
  }
  cin >> m;
  rep(_,m) {
    int x; cin >> x;
    s[x] = 2;
  }
  vl clean(400010, 0);
  clean[0] = 1;
  rep(i,n){
    if (s[i] == 1) clean[i] = 0;
    if (s[i] == 2) clean[i] = 1;
    if (clean[i]) clean[i+k] = 1;
    if (clean[i]) clean[i+1] = 1;
  }
  if (clean[n]) cout << "Yes" << endl;
  else cout << "No" << endl;
}
0