結果
| 問題 |
No.2836 Comment Out
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-09 21:45:17 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 505 bytes |
| コンパイル時間 | 793 ms |
| コンパイル使用メモリ | 94,876 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-09 21:45:24 |
| 合計ジャッジ時間 | 4,608 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 WA * 23 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX_N = 200000;
int N, idx1, idx2;
int A[MAX_N];
bool ans, tmp;
int main() {
cin >> N;
for (int i = 0; i < N; i++)
cin >> A[i];
idx1 = 0; idx2 = N - 1;
while (idx1 < N && A[idx1] <= idx1 + 1)
idx1++;
while (idx2 >= 0 && A[idx2] <= N - idx2)
idx2--;
if ((idx1 > idx2) || ((idx1 == idx2) && A[idx1] <= N))
ans = true;
cout << ((ans) ? "Yes" : "No") << endl;
return 0;
}