結果

問題 No.2615 ペアの作り方
ユーザー hato336hato336
提出日時 2024-01-26 21:29:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 151,680 KB
最終ジャッジ日時 2024-09-28 07:41:54
合計ジャッジ時間 5,212 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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