結果

問題 No.200 カードファイト!
ユーザー lam6er
提出日時 2025-04-15 22:41:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 654 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 91,996 KB
最終ジャッジ日時 2025-04-15 22:43:20
合計ジャッジ時間 6,589 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n = int(input())
a = int(input())
b = list(map(int, input().split()))
c = int(input())
d = list(map(int, input().split()))

# Compute count[x][y]
count = [[0 for _ in range(c)] for _ in range(a)]
for i in range(n):
    x = i % a
    y = i % c
    count[x][y] += 1

max_win = 0

# Generate all permutations of B and D
for b_perm in itertools.permutations(b):
    for d_perm in itertools.permutations(d):
        current = 0
        for i in range(n):
            x = i % a
            y = i % c
            if b_perm[x] > d_perm[y]:
                current += 1
        if current > max_win:
            max_win = current

print(max_win)
0