結果

問題 No.78 クジ付きアイスバー
ユーザー ynyn
提出日時 2015-06-25 01:39:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,333 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-16 05:04:18
合計ジャッジ時間 2,985 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 31 ms
10,880 KB
testcase_15 AC 31 ms
10,880 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 32 ms
10,880 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 31 ms
10,752 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 31 ms
10,752 KB
testcase_26 AC 30 ms
10,880 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 31 ms
10,624 KB
testcase_31 RE -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 31 ms
10,880 KB
testcase_35 RE -
testcase_36 WA -
testcase_37 WA -
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 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)
0