結果
問題 | No.769 UNOシミュレータ |
ユーザー | takumi152 |
提出日時 | 2019-05-28 18:30:54 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 721 ms / 2,000 ms |
コード長 | 1,348 bytes |
コンパイル時間 | 222 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 29,056 KB |
最終ジャッジ日時 | 2024-11-22 09:20:21 |
合計ジャッジ時間 | 6,850 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
10,496 KB |
testcase_01 | AC | 32 ms
10,496 KB |
testcase_02 | AC | 32 ms
10,496 KB |
testcase_03 | AC | 32 ms
10,496 KB |
testcase_04 | AC | 33 ms
10,752 KB |
testcase_05 | AC | 33 ms
10,752 KB |
testcase_06 | AC | 33 ms
10,752 KB |
testcase_07 | AC | 33 ms
10,752 KB |
testcase_08 | AC | 33 ms
10,624 KB |
testcase_09 | AC | 54 ms
11,264 KB |
testcase_10 | AC | 53 ms
11,264 KB |
testcase_11 | AC | 54 ms
11,392 KB |
testcase_12 | AC | 262 ms
16,512 KB |
testcase_13 | AC | 253 ms
16,512 KB |
testcase_14 | AC | 256 ms
16,640 KB |
testcase_15 | AC | 490 ms
22,656 KB |
testcase_16 | AC | 484 ms
22,784 KB |
testcase_17 | AC | 488 ms
22,656 KB |
testcase_18 | AC | 718 ms
28,928 KB |
testcase_19 | AC | 716 ms
29,056 KB |
testcase_20 | AC | 721 ms
29,056 KB |
testcase_21 | AC | 699 ms
29,056 KB |
testcase_22 | AC | 31 ms
10,624 KB |
ソースコード
def main(): buf = input() buflist = buf.split() N = int(buflist[0]) M = int(buflist[1]) cardlog = [] for i in range(M): buf = input() cardlog.append(buf) card_count = [] for i in range(N): card_count.append(0) current_turn = 0 reverse = False lastlog = '' draw_stack = 0 for log in cardlog: if draw_stack > 0 and lastlog != log: card_count[current_turn] -= draw_stack draw_stack = 0 current_turn = next_turn(current_turn, reverse, N) card_count[current_turn] += 1 if log == 'number': pass elif log == 'drawtwo': draw_stack += 2 elif log == 'drawfour': draw_stack += 4 elif log == 'skip': current_turn = next_turn(current_turn, reverse, N) elif log == 'reverse': reverse = not reverse lastlog = log current_turn = next_turn(current_turn, reverse, N) winner = next_turn(current_turn, not reverse, N) if lastlog == 'skip': winner = next_turn(winner, not reverse, N) print(winner + 1, card_count[winner]) def next_turn(current_turn, reverse, N): if reverse: return (current_turn - 1) % N else: return (current_turn + 1) % N if __name__ == '__main__': main()