結果
問題 |
No.921 ずんだアロー
|
ユーザー |
![]() |
提出日時 | 2019-11-08 23:05:30 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 425 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 92,416 KB |
最終ジャッジ日時 | 2024-09-15 02:12:09 |
合計ジャッジ時間 | 2,671 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 8 WA * 14 |
ソースコード
N = int(input()) A = [0] + list(map(int, input().split())) + [0] ans = 0 X = 0 Y = 0 for i in range(N+1): if A[i] != A[i+1]: X += 1 if Y >= 2: ans += Y+1 Y = 0 else: Y = 0 if A[i] == A[i+1]: print('Y') Y += 1 if X > 2: ans += abs(X-2)//2 X = 0 if X == N + 1: print(X//2) else: print(ans)