結果

問題 No.2615 ペアの作り方
ユーザー playerplayer
提出日時 2024-01-28 01:59:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 690 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 124,460 KB
最終ジャッジ日時 2024-01-28 01:59:11
合計ジャッジ時間 6,019 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 33 ms
53,460 KB
testcase_03 AC 42 ms
53,460 KB
testcase_04 AC 33 ms
53,460 KB
testcase_05 AC 32 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 32 ms
53,460 KB
testcase_08 AC 32 ms
53,460 KB
testcase_09 AC 40 ms
59,444 KB
testcase_10 AC 39 ms
59,444 KB
testcase_11 AC 39 ms
59,444 KB
testcase_12 AC 40 ms
59,444 KB
testcase_13 AC 39 ms
59,444 KB
testcase_14 AC 39 ms
59,444 KB
testcase_15 AC 690 ms
124,452 KB
testcase_16 AC 599 ms
124,452 KB
testcase_17 AC 657 ms
124,180 KB
testcase_18 AC 621 ms
124,424 KB
testcase_19 AC 610 ms
124,452 KB
testcase_20 AC 590 ms
124,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
mod = 998244353 

lis = []
for i in range(n):
    lis.append([x[i],"x"])
    lis.append([y[i],"y"])
    
lis.sort()

cntx,cnty = n,n
for i in range(n):
    if lis[i][1] == "x":
        cntx -= 1
    else:
        cnty -= 1
        
ans = 1
for i in range(n):
    if lis[i][1] == "x":
        ans *= cnty
        cnty -= 1
    else:
        ans *= cntx
        cntx -= 1
    ans %= mod
    
print(ans)
0