結果
| 問題 |
No.102 トランプを奪え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-16 08:37:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 369 ms / 5,000 ms |
| コード長 | 733 bytes |
| コンパイル時間 | 264 ms |
| コンパイル使用メモリ | 82,444 KB |
| 実行使用メモリ | 89,768 KB |
| 最終ジャッジ日時 | 2024-06-24 03:24:43 |
| 合計ジャッジ時間 | 2,583 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
ソースコード
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.buffer.readline
X = list(map(int,input().split()))
mem = defaultdict(lambda:-1)
mem[(0,0,0,0)] = 0
def grundy(Y):
if mem[Y]!=-1:
return mem[Y]
Z = list(Y)
tmp = []
for i in range(4):
for j in range(1,4):
if Z[i]-j<0:
break
Z[i] -= j
tmp.append(grundy(tuple(Z)))
Z[i] += j
tmp = set(tmp)
for i in range(20):
if i in tmp:
continue
mem[Y] = i
return i
if grundy(tuple(X)):
print('Taro')
else:
print('Jiro')