結果
| 問題 | No.116 門松列(1) |
| コンテスト | |
| ユーザー |
suibaka_ku
|
| 提出日時 | 2017-03-07 10:38:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 465 bytes |
| 記録 | |
| コンパイル時間 | 686 ms |
| コンパイル使用メモリ | 78,296 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-25 01:27:09 |
| 合計ジャッジ時間 | 1,381 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<int> a(N);
for(int i=0; i<N; ++i) {
cin >> a[i];
}
int res = 0;
for(int i=0; i<N-2; ++i) {
if(a[i] != a[i+2] && (a[i] < a[i+1] && a[i+2] < a[i+1] || a[i] > a[i+1] && a[i+2] > a[i+1])) {
res++;
}
}
cout << res << endl;
}
suibaka_ku