結果
| 問題 |
No.1242 高橋君とすごろく
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-04 05:41:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 884 bytes |
| コンパイル時間 | 951 ms |
| コンパイル使用メモリ | 74,212 KB |
| 最終ジャッジ日時 | 2025-01-15 19:35:55 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <vector>
constexpr int N = 100;
using lint = long long;
void solve() {
lint n;
int k;
std::cin >> n >> k;
std::vector<lint> xs(k);
for (auto& x : xs) {
std::cin >> x;
--x;
}
for (int i = 0; i + 1 < k; ++i) {
if (xs[i] < N / 2) continue;
auto d = xs[i + 1] - xs[i];
if (d < 6 && d % 2 == 1) {
std::cout << "No\n";
return;
}
}
std::vector<bool> out(N, false);
for (auto x : xs) {
if (x < N) out[x] = true;
}
for (int i = N - 7; i >= 0; --i) {
for (int d = 1; d <= 3; ++d) {
if (out[i + d] && out[i + 7 - d]) out[i] = true;
}
}
std::cout << (out[0] ? "No" : "Yes") << "\n";
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}