結果

問題 No.3173 じゃんけんの勝ちの回数
ユーザー 回転
提出日時 2025-06-06 21:55:54
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 589 bytes
コンパイル時間 560 ms
コンパイル使用メモリ 82,852 KB
実行使用メモリ 82,448 KB
最終ジャッジ日時 2025-06-13 05:08:37
合計ジャッジ時間 69,019 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 TLE * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
T = int(input())

def get_min(a,b):
    ok = [(0,2),(1,0),(2,1),(0,0),(1,1),(2,2)]
    
    ret = 10**9
    for oks in permutations(ok):
        now_a = a[:];now_b = b[:]
        for c,d in oks:
            v = min(now_a[c],now_b[d])
            now_a[c] -= v;now_b[d] -= v
        ret = min(ret,sum(now_a))
    return ret

for _ in range(T):
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    MAX = 0
    MAX += min(A[0],B[1])
    MAX += min(A[1],B[2])
    MAX += min(A[2],B[0])

    MIN = get_min(A,B)
    print(MIN,MAX)
0