codeFlyer (bitFlyer Programming Contest)

Submission #10074835

Source codeソースコード

#!/usr/bin/env python3
import sys


def solve(A: int, B: int, N: int, X: str):
    for x in X:
        if x == 'S':
            if 0 < A:
                A-=1
        elif x == 'C':
            if 0 < B:
                B-=1
        else:
            if A > B:
                A-=1
            elif B > A:
                B-=1
            elif 0 < A and 0 < B and A==B:
                A-=1
            elif A==0 and B==0:
                continue

    return A, B


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    X = next(tokens)  # type: str
    a, b = solve(A, B, N, X)
    print("{}\n{}".format(a, b))

if __name__ == '__main__':
    main()

Submission

Task問題 B - 洋菓子店
User nameユーザ名 ch1aki
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 AC
Score得点 200
Source lengthソースコード長 1049 Byte
File nameファイル名
Exec time実行時間 28 ms
Memory usageメモリ使用量 3188 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample-01.txt,sample-02.txt,sample-03.txt,sample-04.txt
All 200 / 200 01.txt,02.txt,03.txt,04.txt,05.txt,06.txt,07.txt,08.txt,sample-01.txt,sample-02.txt,sample-03.txt,sample-04.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt AC 27 ms 3188 KB
02.txt AC 23 ms 3188 KB
03.txt AC 24 ms 3188 KB
04.txt AC 25 ms 3188 KB
05.txt AC 20 ms 3064 KB
06.txt AC 28 ms 3188 KB
07.txt AC 18 ms 3064 KB
08.txt AC 17 ms 3064 KB
sample-01.txt AC 17 ms 3064 KB
sample-02.txt AC 17 ms 3064 KB
sample-03.txt AC 17 ms 3064 KB
sample-04.txt AC 17 ms 3064 KB