結果

問題 No.2615 ペアの作り方
ユーザー hato336hato336
提出日時 2024-01-26 21:29:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 272 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 151,224 KB
最終ジャッジ日時 2024-01-26 21:30:05
合計ジャッジ時間 4,860 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
85,048 KB
testcase_01 AC 128 ms
85,048 KB
testcase_02 AC 125 ms
85,048 KB
testcase_03 AC 122 ms
85,048 KB
testcase_04 AC 125 ms
85,048 KB
testcase_05 AC 124 ms
85,048 KB
testcase_06 AC 123 ms
85,048 KB
testcase_07 AC 122 ms
85,048 KB
testcase_08 AC 131 ms
85,048 KB
testcase_09 AC 140 ms
88,760 KB
testcase_10 AC 141 ms
88,760 KB
testcase_11 AC 136 ms
88,760 KB
testcase_12 AC 136 ms
88,760 KB
testcase_13 AC 138 ms
88,760 KB
testcase_14 AC 137 ms
88,760 KB
testcase_15 AC 272 ms
150,968 KB
testcase_16 AC 251 ms
150,840 KB
testcase_17 AC 243 ms
150,328 KB
testcase_18 AC 243 ms
151,224 KB
testcase_19 AC 243 ms
150,840 KB
testcase_20 AC 266 ms
151,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
n = int(input())
mod = 998244353
x = list(map(int,input().split()))
y = list(map(int,input().split()))
z = x + y
z.sort()
xx = set(x)
yy = set(y)
xxx = 0
yyy = 0
for i in range(n):
    if z[i] in xx:
        xxx += 1
    else:
        yyy += 1
zzz = max(xxx,yyy)
ans = 1
for i in range(1,zzz+1):
    if i <= xxx:
        ans *= i
    if i <= yyy:
        ans *= i
    ans %= mod

print(ans)
0