結果

問題 No.116 門松列(1)
ユーザー 775_koari775_koari
提出日時 2019-12-24 21:00:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 492 bytes
コンパイル時間 1,895 ms
コンパイル使用メモリ 169,432 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 18:15:58
合計ジャッジ時間 3,532 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(3);
  int ans = 0;
  rep(i,n){
  cin >> a[n];
  }
  for(int i=0;i<n-2;i++){
    copy(a.begin()+i,a.begin()+i+2,b.begin());
    int mi = *min_element(b.begin(),b.end());
    int ma = *max_element(b.begin(),b.end());
    if(mi== b[1] || ma == b[1]){
      ans++;
    }
  }
  cout << ans-1 << endl;
  return 0;
}
0