結果
問題 | No.2615 ペアの作り方 |
ユーザー |
|
提出日時 | 2024-01-26 22:02:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 1,629 ms |
コンパイル使用メモリ | 173,768 KB |
実行使用メモリ | 7,524 KB |
最終ジャッジ日時 | 2024-09-28 08:10:05 |
合計ジャッジ時間 | 2,793 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<ll,ll> P;#define REP(i,n) for(int i=0;i<int(n);i++)const ll MOD=998244353;int main(void){cin.tie(nullptr); ios_base::sync_with_stdio(false);ll i,j,k;ll N;cin >> N;vector<P> v;for(i=0;i<N;i++){ll X;cin >> X;v.push_back(P(X,0));}for(i=0;i<N;i++){ll Y;cin >> Y;v.push_back(P(Y,1));}sort(v.begin(),v.end());ll a=0;for(i=0;i<N;i++){if(v[i].second==1) a++;}ll ans=1;for(i=1;i<=a;i++){ans*=i;ans%=MOD;}for(i=1;i<=N-a;i++){ans*=i;ans%=MOD;}cout << ans << endl;return 0;}