結果

問題 No.116 門松列(1)
ユーザー kpinkcatkpinkcat
提出日時 2023-08-03 18:34:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 1,242 ms
コンパイル使用メモリ 107,436 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 16:43:10
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;

int main(){
    int n, cnt = 0;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n;i++) cin >> v[i];
    for (int i = 0; i < n-2; i++){
        if (v[i] != v[i+2] && (v[i+1] == max({v[i], v[i+1], v[i+2]}) || v[i+1] == min({v[i], v[i+1], v[i+2]}))) cnt++;
    } 
    cout << cnt << endl;
}
0