結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー yorry2101yorry2101
提出日時 2023-09-07 16:46:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 963 bytes
コンパイル時間 1,062 ms
コンパイル使用メモリ 76,444 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-07 16:47:03
合計ジャッジ時間 3,037 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,504 KB
testcase_03 AC 23 ms
4,380 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 34 ms
4,380 KB
testcase_06 AC 12 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 6 ms
4,376 KB
testcase_09 AC 10 ms
4,384 KB
testcase_10 AC 20 ms
4,380 KB
testcase_11 AC 14 ms
4,380 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 12 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 3 ms
4,384 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 8 ms
4,380 KB
testcase_26 AC 2 ms
4,384 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 3 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 4 ms
4,384 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
bool check(vector<bool> vec, int sub){
    return sub >= 0 && vec[sub];
}

int main(void){
    int n, k, m1, m2;
    cin >> n >> k;
    vector<bool> ds(n+1);
    cin >> m1;
    int a;
    for (int i = 0; i < m1; i++) {
        cin >> a;
        ds[a] = true;
    }
    vector<bool> scs(n+1);
    cin >> m2;
    int b;
    for (int i = 0; i < m2; i++) {
        cin >> b;
        scs[b] = true;
    }
    
    int dwsn = n;
    while (dwsn >= 0) {
        if (check(scs, dwsn-1) || check(scs, dwsn-k)) {
            cout << "Yes" << endl;
            return 0;
        }
        else if (check(ds, dwsn-1) && check(ds, dwsn-k)) {
            cout << "No" << endl;
            return 0;
        }
        else if (check(ds, dwsn-1)) {
            dwsn -= k;
        }
        else if (check(ds, dwsn-k)) {
            dwsn--;
        }
        else dwsn--;
    }
    cout << "Yes" << endl;
    return 0;
}
0