結果
| 問題 | No.116 門松列(1) |
| コンテスト | |
| ユーザー |
AQUA16573837
|
| 提出日時 | 2018-03-13 01:09:56 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 488 bytes |
| 記録 | |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 60,384 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-11 06:20:24 |
| 合計ジャッジ時間 | 1,267 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <stdio.h>
#include <algorithm>
#include <deque>
using namespace std;
using ll = long long;
//116
int main() {
int n, a[100], count = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", a + i);
for (int i = 1; i < (n - 1); i++)
if ((a[i - 1] != a[i] && a[i] != a[i + 1] && a[i - 1] != a[i + 1]) && (
(int)(a[i - 1] > a[i]) + (int)(a[i - 1] > a[i + 1]) == 1 ||
(int)(a[i + 1] > a[i]) + (int)(a[i + 1] > a[i - 1]) == 1))
count++;
printf("%d\n", count);
}
AQUA16573837