結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー HaaHaa
提出日時 2023-08-04 21:45:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,146 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 175,840 KB
実行使用メモリ 29,064 KB
最終ジャッジ日時 2023-08-23 01:43:00
合計ジャッジ時間 3,785 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 80 ms
17,436 KB
testcase_04 AC 7 ms
4,884 KB
testcase_05 AC 146 ms
29,064 KB
testcase_06 AC 37 ms
10,636 KB
testcase_07 AC 14 ms
6,040 KB
testcase_08 AC 21 ms
8,180 KB
testcase_09 AC 40 ms
12,576 KB
testcase_10 AC 70 ms
17,108 KB
testcase_11 AC 40 ms
10,744 KB
testcase_12 AC 16 ms
5,888 KB
testcase_13 AC 23 ms
15,240 KB
testcase_14 AC 34 ms
23,424 KB
testcase_15 AC 21 ms
14,848 KB
testcase_16 AC 10 ms
7,580 KB
testcase_17 AC 26 ms
17,948 KB
testcase_18 AC 20 ms
14,056 KB
testcase_19 AC 31 ms
20,780 KB
testcase_20 AC 25 ms
17,724 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 15 ms
10,232 KB
testcase_23 AC 13 ms
9,424 KB
testcase_24 AC 15 ms
9,848 KB
testcase_25 AC 29 ms
20,304 KB
testcase_26 AC 14 ms
10,664 KB
testcase_27 AC 31 ms
21,368 KB
testcase_28 AC 23 ms
15,640 KB
testcase_29 AC 15 ms
10,500 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 32 ms
21,580 KB
testcase_32 AC 13 ms
10,160 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T& x, const T& y){return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T& x, const T& y){return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;

int main(){
    int n, k; cin >> n >> k;
    int m; cin >> m;
    VI a(m); REP(i,m) cin >> a[i];
    int l; cin >> l;
    VI b(l); REP(i,l) cin >> b[i];
    set<int> as, bs;
    REP(i,m) as.insert(a[i]);
    REP(i,l) bs.insert(b[i]);
    VVI dp(n*2+10,VI(2,0));
    dp[0][0]=1;
    REP(i,n){
        if(as.count(i)){
            dp[i+1][1]=1;
            dp[i+k][1]=1;
        }
        else if(bs.count(i)){
            dp[i+1][0]=1;
            dp[i+k][0]=1;
        }
        else{
            REP(j,2){
                dp[i+1][j]=dp[i][j];
                dp[i+k][j]=dp[i][j];
            }
        }
    }
    if(dp[n][0])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
0