結果
問題 | No.2402 Dirty Stairs and Shoes |
ユーザー | ruler |
提出日時 | 2023-08-04 21:39:09 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 4,241 bytes |
コンパイル時間 | 3,713 ms |
コンパイル使用メモリ | 265,068 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-20 02:31:04 |
合計ジャッジ時間 | 4,782 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,820 KB |
testcase_03 | AC | 10 ms
6,820 KB |
testcase_04 | AC | 3 ms
6,820 KB |
testcase_05 | AC | 15 ms
6,816 KB |
testcase_06 | AC | 6 ms
6,816 KB |
testcase_07 | AC | 3 ms
6,816 KB |
testcase_08 | AC | 5 ms
6,816 KB |
testcase_09 | AC | 6 ms
6,820 KB |
testcase_10 | AC | 9 ms
6,820 KB |
testcase_11 | AC | 6 ms
6,820 KB |
testcase_12 | AC | 4 ms
6,816 KB |
testcase_13 | AC | 3 ms
6,816 KB |
testcase_14 | AC | 2 ms
6,816 KB |
testcase_15 | AC | 3 ms
6,816 KB |
testcase_16 | AC | 2 ms
6,820 KB |
testcase_17 | AC | 2 ms
6,816 KB |
testcase_18 | AC | 3 ms
6,820 KB |
testcase_19 | AC | 3 ms
6,820 KB |
testcase_20 | AC | 3 ms
6,816 KB |
testcase_21 | AC | 2 ms
6,820 KB |
testcase_22 | AC | 2 ms
6,816 KB |
testcase_23 | AC | 2 ms
6,820 KB |
testcase_24 | AC | 2 ms
6,820 KB |
testcase_25 | AC | 3 ms
6,816 KB |
testcase_26 | AC | 2 ms
6,816 KB |
testcase_27 | AC | 3 ms
6,816 KB |
testcase_28 | AC | 3 ms
6,816 KB |
testcase_29 | AC | 3 ms
6,816 KB |
testcase_30 | AC | 2 ms
6,820 KB |
testcase_31 | AC | 3 ms
6,820 KB |
testcase_32 | AC | 2 ms
6,820 KB |
testcase_33 | AC | 2 ms
6,816 KB |
testcase_34 | AC | 2 ms
6,816 KB |
ソースコード
#pragma GCC optimize("Ofast")#pragma GCC optimize("unroll-loops")#include <bits/stdc++.h>using namespace std;using uint = unsigned int;using ll = long long;using ull = unsigned long long;using ld = long double;using i128 = __int128_t;#define all(a) a.begin(), a.end()template <class A>int len(const A &a) {return a.size();}template <typename T>using vec = vector<T>;template <typename T>using vec2 = vec<vec<T>>;template <typename T>using vec3 = vec<vec2<T>>;template <typename T>using vec4 = vec<vec3<T>>;template <typename T>using vec5 = vec<vec4<T>>;#define VEC(T, a, ...) \vec<T> a(__VA_ARGS__)#define VEC2(T, a, n, ...) \vector a(n, vec<T>(__VA_ARGS__));#define VEC3(T, a, n, m, ...) \vector a( \n, \vector(m, vec<T>(__VA_ARGS__)) \);#define VEC4(T, a, n, m, l, ...) \vector a( \n, \vector( \m, \vector(l, vec<T>(__VA_ARGS__)) \) \);#define eval_4(a, b, c, d, e, ...) e#define loop() while (1)#define rep(n) \for (int __ = 0; __ < n; __++)#define range_1(i, n) \for (int i = 0; i < n; i++)#define range_2(i, a, b) \for (int i = a; i < b; i++)#define range_3(i, a, b, c) \for (int i = a; i < b; i += c)#define range(...) \eval_4(__VA_ARGS__, range_3, range_2, range_1, rep)( \__VA_ARGS__ \)#define ranger_1(i, n) \for (int i = n; i--;)#define ranger_2(i, a, b) \for (int i = b; i-- > a;)#define ranger_3(i, a, b, c) \for (int i = b - 1; i >= a; i -= c)#define range_rev(...) \eval_4(__VA_ARGS__, ranger_3, ranger_2, ranger_1)( \__VA_ARGS__ \)#define iter(x, a) \for (const auto &x : a)#define iter_mut(x, a) \for (auto &&x : a)template <typename T>auto operator<<(ostream &out, vec<T> a)-> ostream & {range(i, len(a)) {if (i) {out << ' ';}out << a[i];}return out;}template <typename T>auto operator<<(ostream &out, vec2<T> a)-> ostream & {iter_mut(x, a) out << x << '\n';return out;}template <typename T>auto operator>>(istream &in, vec<T> &a)-> istream & {iter_mut(x, a) in >> x;return in;}template <typename T, typename U>istream &operator>>(istream &in, pair<T, U> &p) {return in >> p.first >> p.second;}template <typename T, typename U>ostream &operator<<(ostream &out,pair<T, U> &p) {out << p.first << ' ' << p.second;return out;}template <typename... T>void in(T &...a) {(cin >> ... >> a);}template <class T, class... U>void out(T a, const U... b) {cout << a;((cout << ' ' << b), ...);cout << '\n';}vec<int> iota(int n) {vec<int> a(n);std::iota(all(a), 0);return a;}template <class T>using max_queue = priority_queue<T>;template <class T>using min_queue =priority_queue<T, vec<T>, greater<T>>;template <typename T>T pop(queue<T> &q) {T v = q.front();q.pop();return v;}template <typename T>T pop(deque<T> &q) {T v = q.front();q.pop_front();return v;}template <typename T>T pop(vec<T> &q) {T v = q.back();q.pop_back();return v;}template <typename T>T pop(max_queue<T> &q) {T v = q.top();q.pop();return v;}template <typename T>T pop(min_queue<T> &q) {T v = q.top();q.pop();return v;}// define yes/no#define yesno(y, n) \void yes(bool f = 1) { \out(f ? #y : #n); \} \void no() { \out(#n); \}// yesno(yes, no);yesno(Yes, No);// yesno(YES, NO);template <typename T>T max(const vec<T> &a) {return *max_element(all(a));}template <typename T>T min(const vec<T> &a) {return *max_element(all(a));}int topbit(int x) {return 31 - __builtin_clz(x);}void solve() {int n, k;in(n, k);int m1;in(m1);vec<int> a(m1);in(a);int m2;in(m2);vec<int> b(m2);in(b);vec<int> dp(n + 1);iter(x, a) {dp[x] = -1;}iter(x, b) {dp[x] = 1;}dp[0] = 1;range(i, 1, n + 1) {if (dp[i] != 0) {continue;}if (dp[i - 1] == 1) {dp[i] = 1;}if (i >= k && dp[i - k] == 1) {dp[i] = 1;}}yes(dp[n] == 1);}int main() {ios::sync_with_stdio(0);cin.tie(0);// cout << setprecision(16);int t = 1;// in(t);while (t--) {solve();}}