結果
問題 |
No.116 門松列(1)
|
ユーザー |
![]() |
提出日時 | 2022-09-02 21:49:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 375 bytes |
コンパイル時間 | 1,638 ms |
コンパイル使用メモリ | 195,724 KB |
最終ジャッジ日時 | 2025-02-07 01:05:22 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int N; cin>>N; vector<int> S(N); for(int i=0;i<N;i++) cin>>S[i]; int ans = 0; for(int i=0;i<N-2;i++){ int j=i+1,k=i+2; if((S[j] == min({S[i],S[j],S[k]}) || S[j] == max({S[i],S[j],S[k]})) && S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) ans++; } cout<<ans<<endl; }