結果

問題 No.1188 レベルX門松列
ユーザー kozykozy
提出日時 2020-08-22 15:31:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,058 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,716 KB
最終ジャッジ日時 2024-04-23 09:49:06
合計ジャッジ時間 3,505 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
17,664 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 33 ms
10,752 KB
testcase_06 AC 82 ms
12,660 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 32 ms
10,880 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 31 ms
10,752 KB
testcase_21 AC 31 ms
10,880 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 32 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N=int(input())
L=list(map(int,input().split()))
if N==1 or N==2:
    print(0)
    exit()
a=L[0]
p=-1
ans=list()
for i in range(1,N):
    if p==-1:
        if L[i]>a:
            p=1
            count=2
        elif L[i]<a:
            p=0
            count=2
        a=L[i]
        continue
    if L[i]>a and p==1:
        count+=1
    elif L[i]>a and p==0:
        ans.append(count)
        count=2
        p=1
    elif L[i]<a and p==1:
        ans.append(count)
        count=2
        p=0
    elif L[i]<a and p==0:
        count+=1
    else:
        ans.append(count)
        p=-1
        ans.append(0)
    if i==N-1:
      ans.append(count)
    a=L[i]
if len(ans)==1:
  print(0)
  exit()
maxa=1
for i in range(len(ans)-1):
  s=min(ans[i],ans[i+1])
  maxa=max(maxa,s)
print(maxa-1)
0