結果

問題 No.2615 ペアの作り方
ユーザー karinohitokarinohito
提出日時 2024-02-07 01:38:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 324 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 212,520 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-02-07 01:38:51
合計ジャッジ時間 6,008 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 4 ms
6,676 KB
testcase_10 AC 4 ms
6,676 KB
testcase_11 AC 4 ms
6,676 KB
testcase_12 AC 3 ms
6,676 KB
testcase_13 AC 4 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 273 ms
13,440 KB
testcase_16 AC 295 ms
13,440 KB
testcase_17 AC 238 ms
13,440 KB
testcase_18 AC 308 ms
13,440 KB
testcase_19 AC 324 ms
13,440 KB
testcase_20 AC 276 ms
13,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using namespace atcoder;
using mint=modint998244353;

int main(){
    int N,k=0,n=0;
    cin>>N;
    map<int,int> M;
    vector<int> X(N),Y(N);
    for(int &x:X)cin>>x,M[x]=1;
    for(int &y:Y)cin>>y,M[y]=1;
    for(auto m:M)M[m.first]=k,k++;
    for(int &x:X){
        x=M[x];
        if(x<N)n++;
    }
    for(int &y:Y)y=M[y];
    mint an=1;
    for(int i=1;i<=n;i++)an*=i;
    for(int i=1;i<=N-n;i++)an*=i;
    cout<<an.val()<<endl;
}
0