結果

問題 No.769 UNOシミュレータ
ユーザー daku9640daku9640
提出日時 2018-12-25 22:28:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 706 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 9,612 KB
最終ジャッジ日時 2023-08-14 12:01:24
合計ジャッジ時間 5,533 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,800 KB
testcase_01 AC 15 ms
7,824 KB
testcase_02 AC 16 ms
7,800 KB
testcase_03 AC 16 ms
7,784 KB
testcase_04 AC 17 ms
7,760 KB
testcase_05 AC 17 ms
7,772 KB
testcase_06 AC 18 ms
7,864 KB
testcase_07 AC 17 ms
7,796 KB
testcase_08 AC 17 ms
7,824 KB
testcase_09 AC 34 ms
8,100 KB
testcase_10 AC 33 ms
8,216 KB
testcase_11 AC 33 ms
7,868 KB
testcase_12 AC 199 ms
8,200 KB
testcase_13 AC 196 ms
8,204 KB
testcase_14 AC 200 ms
8,284 KB
testcase_15 AC 379 ms
8,780 KB
testcase_16 AC 379 ms
8,716 KB
testcase_17 AC 388 ms
8,748 KB
testcase_18 AC 574 ms
9,604 KB
testcase_19 AC 569 ms
9,612 KB
testcase_20 AC 569 ms
9,580 KB
testcase_21 AC 563 ms
9,468 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

draw = {"drawtwo":2, "drawfour":4}
def solve():
    n, m = map(int, input().split())
    fi = [0] * n
    se = [0] * n
    cnt = 1
    draw_cnt = 0
    no = 0
    last = ""
    for _ in range(m):
        l = input()
        if l != last and "draw" in last:
            se[no] += draw[last] * draw_cnt
            no = (no + cnt) % n
            draw_cnt = 0
        if se[no] == 0:
            fi[no] += 1
        else:
            se[no] -= 1
        if "draw" in l:
            draw_cnt += 1
        elif "skip" == l:
            no = (no + cnt) % n
        elif "reverse" == l:
            cnt *= -1
        no = (no + cnt) % n
        last = l
    no = (no - cnt) % n
    print(no + 1, fi[no])
solve()
0