結果
問題 | No.769 UNOシミュレータ |
ユーザー | sobasssy |
提出日時 | 2018-12-27 20:42:53 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,606 bytes |
コンパイル時間 | 352 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-11-22 09:01:22 |
合計ジャッジ時間 | 7,257 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
10,752 KB |
testcase_01 | AC | 30 ms
10,752 KB |
testcase_02 | AC | 31 ms
10,752 KB |
testcase_03 | AC | 31 ms
10,624 KB |
testcase_04 | WA | - |
testcase_05 | AC | 33 ms
10,624 KB |
testcase_06 | AC | 33 ms
10,624 KB |
testcase_07 | AC | 33 ms
10,624 KB |
testcase_08 | AC | 33 ms
10,752 KB |
testcase_09 | WA | - |
testcase_10 | AC | 54 ms
11,008 KB |
testcase_11 | AC | 56 ms
10,880 KB |
testcase_12 | WA | - |
testcase_13 | AC | 271 ms
10,880 KB |
testcase_14 | AC | 265 ms
11,008 KB |
testcase_15 | WA | - |
testcase_16 | AC | 504 ms
11,264 KB |
testcase_17 | WA | - |
testcase_18 | AC | 730 ms
11,904 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 744 ms
11,776 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 if (char != "drawfour") and self.draw4: self.cards[self.position] += self.draw4_count self.update_pos() self.draw4 = False 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()