結果
| 問題 |
No.2836 Comment Out
|
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2024-08-09 21:25:03 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 637 bytes |
| コンパイル時間 | 5,397 ms |
| コンパイル使用メモリ | 312,184 KB |
| 実行使用メモリ | 17,456 KB |
| 最終ジャッジ日時 | 2024-08-09 21:25:16 |
| 合計ジャッジ時間 | 9,954 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 WA * 23 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, 0, n) cin >> a[i];
dsu uf(n);
rep(i, 0, n - 1) {
if (abs(a[i] - a[i + 1]) <= 1)
uf.merge(i, i + 1);
}
auto vx = uf.groups();
for (auto v : vx) {
int mn = 1e9;
for (auto x : v)
mn = min(mn, a[x]);
if (mn >= 2) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
SnowBeenDiding