結果
問題 |
No.78 クジ付きアイスバー
|
ユーザー |
![]() |
提出日時 | 2015-06-25 01:39:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,333 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-06 17:10:03 |
合計ジャッジ時間 | 2,503 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 8 WA * 23 RE * 4 |
ソースコード
# your code goes here N, K = map(int,input().split()) S = input() must = [False] * N buy = 1 atari = 0 i = 0 l = 0 for i in range(N): if S[i] == '0': if atari > 0: atari -= 1 else: must[i] = True elif S[i] == '1': if atari > 0 : atari -= 1 else: must[i] = True atari += 1 else : i += 1 if atari > 0: atari -= 1 else: must[i] = True atari += 2 l = K % N count = 0 for i in range(N): if must[i]: count += 1 must = [False] * N atariend = atari for x in range(l): if S[i] == '0': if atariend > 0: atariend -= 1 else: must[i] = True elif S[i] == '1': if atariend > 0 : atariend -= 1 else: must[i] = True atariend += 1 else : if atariend > 0: atariend -= 1 else: must[i] = True atariend += 2 countend = 0 for i in range(l): if must[i]: countend += 1 if atari >= count : buy = 1 else: if l == 0: buy = count + (count - atari) * (K // N - 1) else : buy = count + (count - atariend) * (K // N - 1) + countend print(buy)