結果
| 問題 |
No.1242 高橋君とすごろく
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-02 22:36:12 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,430 bytes |
| コンパイル時間 | 3,132 ms |
| コンパイル使用メモリ | 133,688 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 02:48:39 |
| 合計ジャッジ時間 | 3,899 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <optional>
#include <utility>
#include <vector>
#include <set>
template <class InputIterator>
std::ostream& range_output(std::ostream& os_arg, InputIterator first_arg, InputIterator last_arg){ if(first_arg != last_arg){ do{ os_arg << *(first_arg++); if(first_arg == last_arg) break; os_arg << ' '; } while(true); } return os_arg; }
template <class Tp> std::ostream& operator << (std::ostream& os_arg, const std::vector<Tp>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class Tp, std::size_t Size> std::ostream& operator << (std::ostream& os_arg, const std::array<Tp, Size>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class S, class T> std::ostream& operator << (std::ostream& os_arg, const std::pair<S, T>& pair_arg){ return os_arg << '(' << pair_arg.first << ", " << pair_arg.second << ')'; }
#ifndef ONLINE_JUDGE
template <typename Head> void dump_out(Head head_arg){ std::cerr << head_arg << '\n'; }
template <typename Head, typename... Tail>
void dump_out(Head head_arg, Tail... tail_args){ std::cerr << head_arg << ", "; dump_out(tail_args...); }
#define dump(...) do { std::cerr << "[in line " << __LINE__ << "] " << #__VA_ARGS__ << " : "; dump_out(__VA_ARGS__); } while(false)
#else
#define dump(...) (void(0))
#endif
int main(void){
std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(16);
long long int n; int k; std::cin >> n >> k;
std::vector<long long int> A(k); for(auto& itr : A){ std::cin >> itr; --itr; }
std::vector<int> T(k);
long long int prev = 0; int pos = 0;
for(int i = 0; i < k; prev = A[i++]){
pos += std::min<long long int>(30, A[i] - prev);
T[i] = pos;
}
pos += std::min<long long int>(30, n - A.back());
std::set<int> S(T.cbegin(), T.cend());
std::vector<bool> X(pos + 1, false); X[pos] = true;
for(int i = pos - 1; i >= 0; --i) if(S.find(i) == S.end()){
bool flag = true;
for(int x = 1; x <= 3; ++x){
const int s = std::min(i + x, pos);
const int t = std::min(i + 7 - x, pos);
flag &= (X[s] or X[t]);
}
X[i] = flag;
}
if(X[0]) std::cout << "Yes\n"; else std::cout << "No\n";
return 0;
}