結果

問題 No.769 UNOシミュレータ
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2019-11-27 13:33:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,471 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 29,312 KB
最終ジャッジ日時 2024-05-02 00:42:17
合計ジャッジ時間 7,937 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 33 ms
10,880 KB
testcase_06 RE -
testcase_07 AC 33 ms
10,880 KB
testcase_08 AC 34 ms
10,880 KB
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 AC 317 ms
16,768 KB
testcase_15 WA -
testcase_16 AC 599 ms
22,912 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 AC 887 ms
29,056 KB
testcase_22 AC 30 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

input_params = list(map(int,input().split()))
n = input_params[0]
m = input_params[1]
card = [input() for i in range(m)]
count = [0] * n

def get_next_turn(turn, direction):
    if direction == 1:
        if turn == n:
            return 1
        else:
            return turn + 1
    else:
        if turn == 1:
            return n
        else:
            return turn -1
        
turn = 1
direction = 1
res = -1
for i in range(len(card)):
    # print('turn: {}'.format(turn))
    if i == len(card)-1:
        res = turn
        
        
    count[turn-1] += 1
    
    if card[i] == 'number':
        turn = get_next_turn(turn, direction)
    elif card[i] == 'drawtwo':
        if card[i+1] == 'drawtwo':
            turn = get_next_turn(turn, direction)
        else:
            turn = get_next_turn(turn, direction)
            count[turn-1] -= 2
            turn = get_next_turn(turn, direction)
    elif card[i] == 'drawfour':
        if card[i+1] == 'drawfour':
            turn = get_next_turn(turn, direction)
        else:
            turn = get_next_turn(turn, direction)
            count[turn-1] -= 4
            turn = get_next_turn(turn, direction)
    elif card[i] == 'skip':
        turn = get_next_turn(turn, direction)
        turn = get_next_turn(turn, direction)
    elif card[i] == 'reverse':
        direction *= -1
        turn = get_next_turn(turn, direction)
    
print('{} {}'.format(res, count[res-1]))
0