結果
| 問題 |
No.1242 高橋君とすごろく
|
| コンテスト | |
| ユーザー |
takayg
|
| 提出日時 | 2020-10-02 22:25:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,084 bytes |
| コンパイル時間 | 2,067 ms |
| コンパイル使用メモリ | 205,192 KB |
| 最終ジャッジ日時 | 2025-01-15 00:37:42 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 TLE * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rrep(i, n) for(int i = (int)(n) - 1; i >= 0; i --)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define sll set<ll>
#define spll set<pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define mod2 998244353
#define inf 1000000000000000000
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rsort(a) sort(a.rbegin(), a.rend())
#define print(x) for(auto i : (x)) cout << i << " "; cout << endl
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// const ll dx[] = {-1,0,1,0,-1,-1,1,1};
// const ll dy[] = {0,-1,0,1,-1,1,-1,1};
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << setprecision(15) << fixed;
ll n, k; cin >> n >> k;
vll a(k);
sll s;
rep(i, k) {
cin >> a[i];
s.insert(a[i]);
}
bool flag = true;
priority_queue<
ll, // 要素の型はint
vector<ll>, // 内部コンテナはstd::vector (デフォルトのまま)
greater<ll> // 昇順 (デフォルトはstd::less<T>)
> queue;
for (auto i : a) queue.push(i);
while(queue.size() != 0) {
auto i = queue.top(); queue.pop();
for (int j = 1; j <= 6; j++) {
if (i - j < 1 || (i - j) + (7 - j) >= n) continue;
if (s.find((i - j) + (7 - j)) != s.end()) {
queue.push(i - j);
s.insert(i - j);
}
}
if (s.find(1) != s.end()) {
flag = false;
break;
}
}
if (flag) cout << "Yes" << endl;
else cout << "No" << endl;
}
takayg