結果
| 問題 |
No.921 ずんだアロー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-10 13:09:30 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 633 bytes |
| コンパイル時間 | 219 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 20,912 KB |
| 最終ジャッジ日時 | 2024-09-14 23:02:40 |
| 合計ジャッジ時間 | 2,469 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 2 |
ソースコード
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque
from heapq import heapify,heappush,heappop
def main():
n = int(input())
a = list(map(int,input().split()))
a = [a[0]] + a + [a[-1]]
ans = (n + 1)//2
cnt1 = (n + 1)//2
cnt2 = n//2
for i in range(1,n + 1):
if i%2 == 0:
if a[i - 1] == a[i] == a[i + 1]:
cnt1 += 1
else:
if a[i - 1] == a[i] == a[i + 1]:
cnt2 += 1
ans = max(ans,cnt1,cnt2)
print(ans)
if __name__ =='__main__':
main()