結果
問題 |
No.3173 じゃんけんの勝ちの回数
|
ユーザー |
|
提出日時 | 2025-02-23 14:39:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,381 ms / 2,000 ms |
コード長 | 797 bytes |
コンパイル時間 | 377 ms |
コンパイル使用メモリ | 82,572 KB |
実行使用メモリ | 79,608 KB |
最終ジャッジ日時 | 2025-08-26 09:49:25 |
合計ジャッジ時間 | 43,904 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
import itertools T = int(input()) # 順列 Permut = [[0, 0], [0, 2], [1, 0], [1, 1], [2, 1], [2, 2]] for testcase in range(T): A = list(map(int, input().split())) B = list(map(int, input().split())) # 最大値の答え maxv = min(A[0], B[1]) + min(A[1], B[2]) + min(A[2], B[0]) # あいこと負けの最大値 mx_used = 0 # 順列全探索でどの順で使用するかを全探索 for P in itertools.permutations(Permut): tot = 0 tmp_A = A.copy() tmp_B = B.copy() for u, v in P: d = min(tmp_A[u], tmp_B[v]) tmp_A[u] -= d tmp_B[v] -= d tot += d mx_used = max(mx_used, tot) # 最小値の答え minv = sum(A) - mx_used # 答えを出力 print(minv, maxv)