結果
問題 |
No.3173 じゃんけんの勝ちの回数
|
ユーザー |
|
提出日時 | 2025-02-23 14:42:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,403 ms / 2,000 ms |
コード長 | 846 bytes |
コンパイル時間 | 424 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 80,000 KB |
最終ジャッジ日時 | 2025-02-23 14:42:45 |
合計ジャッジ時間 | 44,702 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
from sys import stdin import itertools T = int(stdin.readline()) # 順列 Permut = [[0, 0], [0, 2], [1, 0], [1, 1], [2, 1], [2, 2]] for testcase in range(T): A = list(map(int, stdin.readline().split())) B = list(map(int, stdin.readline().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)