結果

問題 No.921 ずんだアロー
ユーザー yakeshibayakeshiba
提出日時 2020-10-31 23:38:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,752 KB
実行使用メモリ 96,308 KB
最終ジャッジ日時 2023-09-29 10:50:50
合計ジャッジ時間 4,398 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,464 KB
testcase_01 WA -
testcase_02 AC 71 ms
71,356 KB
testcase_03 AC 74 ms
71,292 KB
testcase_04 AC 68 ms
71,540 KB
testcase_05 AC 69 ms
71,532 KB
testcase_06 AC 69 ms
71,076 KB
testcase_07 AC 68 ms
71,304 KB
testcase_08 AC 69 ms
71,312 KB
testcase_09 AC 69 ms
71,288 KB
testcase_10 AC 97 ms
93,800 KB
testcase_11 WA -
testcase_12 AC 81 ms
77,584 KB
testcase_13 AC 94 ms
89,188 KB
testcase_14 AC 94 ms
91,492 KB
testcase_15 AC 85 ms
84,452 KB
testcase_16 AC 77 ms
76,284 KB
testcase_17 AC 97 ms
93,528 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 97 ms
96,308 KB
testcase_24 AC 90 ms
90,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))

groups = []
for i, a in enumerate(A):
    if i == 0:
        prev = a
        cnt = 1
        continue
    if a != prev:
        groups.append(cnt)
        prev = a
        cnt = 1
    else:
        cnt += 1
groups.append(cnt)

#print(groups)

tmp = 0
tmp2 = 0
for i in range(0,len(groups),2):
    tmp += groups[i]
for i in range(1,len(groups),2):
    tmp2 += groups[i]
    
print(max(tmp, tmp2))
0