結果
問題 | No.769 UNOシミュレータ |
ユーザー | sobasssy |
提出日時 | 2018-12-27 20:46:18 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,681 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-05-02 00:20:31 |
合計ジャッジ時間 | 6,305 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
10,880 KB |
testcase_01 | AC | 29 ms
10,880 KB |
testcase_02 | AC | 28 ms
10,880 KB |
testcase_03 | AC | 29 ms
10,880 KB |
testcase_04 | AC | 32 ms
10,752 KB |
testcase_05 | AC | 29 ms
10,880 KB |
testcase_06 | AC | 27 ms
11,008 KB |
testcase_07 | AC | 28 ms
11,008 KB |
testcase_08 | AC | 28 ms
10,880 KB |
testcase_09 | AC | 49 ms
11,008 KB |
testcase_10 | AC | 47 ms
11,008 KB |
testcase_11 | AC | 50 ms
11,008 KB |
testcase_12 | AC | 242 ms
11,008 KB |
testcase_13 | AC | 240 ms
11,008 KB |
testcase_14 | AC | 244 ms
10,880 KB |
testcase_15 | AC | 450 ms
11,392 KB |
testcase_16 | AC | 452 ms
11,392 KB |
testcase_17 | AC | 451 ms
11,520 KB |
testcase_18 | AC | 684 ms
12,032 KB |
testcase_19 | AC | 662 ms
11,776 KB |
testcase_20 | AC | 673 ms
11,776 KB |
testcase_21 | AC | 678 ms
11,904 KB |
testcase_22 | WA | - |
ソースコード
class Uno: def __init__(self): ipt = input().split(" ") self.peoples = int(ipt[0]) self.logs = int(ipt[1]) self.position = 0 self.cards = [] self.draw2 = False self.draw2_count = 0 self.draw4 = False self.draw4_count = 0 self.reverse = False for x in range(self.peoples): self.cards.append(0) def update_pos(self): if not self.reverse: self.position += 1 if self.position == self.peoples: self.position = 0 else: self.position -= 1 if self.position == -1: self.position = self.peoples - 1 def func_number(self): self.cards[self.position] -= 1 self.update_pos() def func_reverse(self): self.cards[self.position] -= 1 if self.reverse: self.reverse = False else: self.reverse = True self.update_pos() def finalize(self): if self.reverse: self.reverse = False else: self.reverse = True self.update_pos() def func_skip(self): self.cards[self.position] -= 1 self.update_pos() self.update_pos() def func_draw2(self): self.draw2 = True self.draw2_count += 2 self.cards[self.position] -= 1 self.update_pos() def func_draw4(self): self.draw4 = True self.draw4_count += 4 self.cards[self.position] -= 1 self.update_pos() def main(self): for x in range(self.logs): char = input() if (char != "drawtwo") and self.draw2: self.cards[self.position] += self.draw2_count self.update_pos() self.draw2 = False self.draw2_count = 0 if (char != "drawfour") and self.draw4: self.cards[self.position] += self.draw4_count self.update_pos() self.draw4 = False self.draw4_count = 0 if char == "number": self.func_number() if char == "drawtwo": self.func_draw2() if char == "drawfour": self.func_draw4() if char == "skip": self.func_skip() if char == "reverse": self.func_reverse() # print(x, self.position, self.cards) self.finalize() # print("finalize: ", self.position, self.cards) print("{} {}".format(self.position + 1, abs(self.cards[self.position]))) if __name__ == "__main__": Uno().main()