結果

問題 No.2727 Tetrahedron Game
ユーザー 👑 p-adicp-adic
提出日時 2024-04-12 23:07:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 78,920 KB
最終ジャッジ日時 2024-04-12 23:07:55
合計ジャッジ時間 3,093 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
65,656 KB
testcase_01 AC 394 ms
78,920 KB
testcase_02 AC 261 ms
77,876 KB
testcase_03 AC 131 ms
76,308 KB
testcase_04 AC 128 ms
76,476 KB
testcase_05 AC 144 ms
76,668 KB
testcase_06 AC 159 ms
76,884 KB
testcase_07 AC 147 ms
76,404 KB
testcase_08 AC 142 ms
76,616 KB
testcase_09 AC 168 ms
76,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R,O=input,range,print
J=lambda:map(int,I().split())
L=606
for t in R(int(I())):
	N,K=J()
	P1=list(J())
	P2=list(J())
	P3=list(J())
	A=list(J())
	S=I()
	V=abs(P1[0]*P2[1]*P3[2]+P1[1]*P2[2]*P3[0]+P1[2]*P2[0]*P3[1]-P1[1]*P2[0]*P3[2]-P1[0]*	P2[2]*P3[1]-P1[2]*P2[1]*P3[0])
	D=[1if k%6else(k%101<K)*2for k in R(L)]
	for i in R(N-1,-1,-1):
		E=[D[j*(1+A[i])%L]for j in R(L)]
		D=[max(D[i],E[i])for i in R(L)]if S[i]=='P'else[min(D[i],E[i])for i in R(L)]
	O("KDP"[D[V*17%L]]if V else"D")
0