結果

問題 No.769 UNOシミュレータ
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2022-07-10 16:59:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 98,180 KB
最終ジャッジ日時 2023-09-02 00:01:36
合計ジャッジ時間 6,305 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
70,976 KB
testcase_01 AC 73 ms
71,184 KB
testcase_02 AC 76 ms
71,076 KB
testcase_03 AC 76 ms
71,400 KB
testcase_04 AC 91 ms
75,580 KB
testcase_05 AC 90 ms
75,588 KB
testcase_06 AC 91 ms
75,456 KB
testcase_07 AC 92 ms
75,732 KB
testcase_08 AC 91 ms
75,752 KB
testcase_09 AC 130 ms
77,736 KB
testcase_10 AC 133 ms
77,940 KB
testcase_11 AC 130 ms
77,868 KB
testcase_12 AC 204 ms
82,008 KB
testcase_13 AC 206 ms
81,984 KB
testcase_14 AC 209 ms
81,976 KB
testcase_15 AC 279 ms
89,476 KB
testcase_16 AC 291 ms
90,148 KB
testcase_17 AC 282 ms
91,448 KB
testcase_18 AC 364 ms
97,240 KB
testcase_19 AC 360 ms
97,116 KB
testcase_20 AC 369 ms
98,180 KB
testcase_21 AC 361 ms
97,004 KB
testcase_22 AC 75 ms
71,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

bufio_scanner = []


def fmt_scan() -> str:
    sc = bufio_scanner
    if len(sc) == 0:
        for v in reversed(input().split()):
            sc.append(v)
    return sc.pop()


def main():
    n, m = [int(fmt_scan()) for _ in range(2)]
    a = [[] for _ in range(n)]
    ad = [0 for _ in range(n)]

    i = 0
    r = 1
    k = 1
    pre = ""
    for j in range(m):
        s = fmt_scan()
        if pre in ["drawtwo", "drawfour"]:
            if s != pre:
                ad[i % n] += 2 * k if "two" in pre else 4 * k
                i += r
                k = 1
            else:
                k += 1

        a[i % n].append(s)
        if j == m - 1:
            break
        if s == "skip":
            i += r
        elif s == "reverse":
            r *= -1

        i += r
        pre = s

    i %= n
    print(i + 1, len(a[i]) - ad[i])


main()
0