結果
問題 | No.1242 高橋君とすごろく |
ユーザー |
|
提出日時 | 2023-04-30 21:55:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,337 bytes |
コンパイル時間 | 1,765 ms |
コンパイル使用メモリ | 171,472 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-19 11:34:28 |
合計ジャッジ時間 | 2,964 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define srep(i, s, n) for (int i=(s); i < (int)(n); i++)#define all(v) v.begin(), v.end()#define fore(i,x) for(auto i:x)#define pb push_backusing vi=vector<int>;using vvi=vector<vi>;using vb=vector<bool>;using vvb=vector<vb>;using vs=vector<string>;using vll=vector<long long>;using vvll=vector<vll>;using vc=vector<char>;using vvc=vector<vc>;using ll=long long;void Yes(bool ok){ cout << (ok ? "Yes" : "No") << "\n";}int main(){ll N,K; cin >> N >> K;vll A(K);rep(i,K) cin >> A.at(i);vb GO(30);rep(i,K-1){ll d=A.at(i+1)-A.at(i);if(d==1 || d==3 || d==5){if(A.at(i)<=20){GO.at(A.at(i+1))=true;GO.at(A.at(i))=true;for(int j=24;j>=0;j--){if(j-3>=0){if(GO.at(j) && GO.at(j+1)) GO.at(j-3)=true;}if(j-2>=0){if(GO.at(j) && GO.at(j+3)) GO.at(j-2)=true;}if(j-1>=0){if(GO.at(j) && GO.at(j+5)) GO.at(j-1)=true;}}}else GO.at(1)=true;}}Yes(!GO.at(1));}