結果
問題 |
No.200 カードファイト!
|
ユーザー |
![]() |
提出日時 | 2025-06-12 17:05:28 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,074 bytes |
コンパイル時間 | 398 ms |
コンパイル使用メモリ | 82,000 KB |
実行使用メモリ | 855,972 KB |
最終ジャッジ日時 | 2025-06-12 17:05:36 |
合計ジャッジ時間 | 7,357 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | MLE * 1 -- * 25 |
ソースコード
import itertools def main(): import sys input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]) ptr +=1 A = int(input[ptr]) ptr +=1 B = list(map(int, input[ptr:ptr+A])) ptr +=A C = int(input[ptr]) ptr +=1 D = list(map(int, input[ptr:ptr+C])) ptr +=C max_victory = 0 # 生成所有可能的A的排列顺序 A_perms = list(itertools.permutations(B)) # 生成所有可能的C的排列顺序 C_perms = list(itertools.permutations(D)) for a_order in A_perms: for c_order in C_perms: i = 0 j = 0 victory = 0 for _ in range(N): a = a_order[i % A] c = c_order[j % C] if a > c: victory +=1 i +=1 j +=1 if victory > max_victory: max_victory = victory if max_victory == N: break if max_victory == N: break print(max_victory) if __name__ == "__main__": main()