結果
問題 |
No.2615 ペアの作り方
|
ユーザー |
|
提出日時 | 2024-02-07 01:38:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 308 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 1,925 ms |
コンパイル使用メモリ | 202,132 KB |
最終ジャッジ日時 | 2025-02-19 02:40:41 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#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; }