結果

問題 No.1188 レベルX門松列
ユーザー CaliforniumerCaliforniumer
提出日時 2020-08-22 15:36:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 2,010 ms
コンパイル使用メモリ 167,284 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 09:55:10
合計ジャッジ時間 2,626 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;cin>>N;int M=1;
    vector<long long>V(N);
    vector<long long>L(0);
    for(int X=0;X<N;X++){
        cin>>V[X];
        if(X>1){
            if((V[X-1]-V[X])==0){
                L.push_back(M);M=0;
            }
          else if((V[X-1]-V[X]>0&&V[X-2]-V[X-1]>=0)||(V[X-1]-V[X]<0&&V[X-2]-V[X-1]<=0))M++;
            else if((V[X-1]-V[X]>0&&V[X-2]-V[X-1]<=0)||(V[X-1]-V[X]<0&&V[X-2]-V[X-1]>=0)){
                L.push_back(M);M=1;
            }
        }
        if(X==1){
            if(V[X]==V[X-1])int M=0;
            else int M=1;
        }
      if(X==N-1){
        if(M!=0)L.push_back(M);
      }
    }
    long long U=0;
    for(int X=1;X<L.size();X++){
        if(U<min(L[X],L[X-1]))U=min(L[X],L[X-1]);
    }
    cout<<U<<endl;
}
0