結果
| 問題 |
No.1242 高橋君とすごろく
|
| コンテスト | |
| ユーザー |
kibuna
|
| 提出日時 | 2020-10-02 22:23:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,129 bytes |
| コンパイル時間 | 1,888 ms |
| コンパイル使用メモリ | 183,600 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 02:47:37 |
| 合計ジャッジ時間 | 2,562 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
lint n, k;
cin >> n >> k;
vector<lint> a(k);
priority_queue<lint> pq;
for (int i = 0; i < k; ++i) {
cin >> a[i];
pq.push(a[i]);
}
map<lint, bool> mp;
while (!pq.empty()) {
lint idx = pq.top();
pq.pop();
if (idx <= 0)
break;
mp[idx] = true;
bool ok = false;
for (lint j = idx + 1; j <= idx + 6; ++j) {
if (!mp[j])
ok = true;
}
if (!ok) {
cout << "No"
<< "\n";
return 0;
}
if (mp[idx + 5]) {
pq.push(idx - 1);
}
if (mp[idx + 3]) {
pq.push(idx - 2);
}
if (mp[idx + 1]) {
pq.push(idx - 3);
}
}
if (mp[1]) {
cout << "No"
<< "\n";
} else {
cout << "Yes"
<< "\n";
}
return 0;
}
kibuna