結果

問題 No.2615 ペアの作り方
ユーザー umezoumezo
提出日時 2024-01-27 04:48:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 2,533 ms
コンパイル使用メモリ 210,596 KB
実行使用メモリ 11,012 KB
最終ジャッジ日時 2024-01-27 04:49:02
合計ジャッジ時間 4,416 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
8,272 KB
testcase_01 AC 5 ms
8,272 KB
testcase_02 AC 5 ms
8,272 KB
testcase_03 AC 5 ms
8,272 KB
testcase_04 AC 6 ms
8,272 KB
testcase_05 AC 6 ms
8,272 KB
testcase_06 AC 6 ms
8,272 KB
testcase_07 AC 6 ms
8,272 KB
testcase_08 AC 6 ms
8,272 KB
testcase_09 AC 6 ms
8,272 KB
testcase_10 AC 6 ms
8,272 KB
testcase_11 AC 6 ms
8,272 KB
testcase_12 AC 6 ms
8,272 KB
testcase_13 AC 6 ms
8,272 KB
testcase_14 AC 6 ms
8,272 KB
testcase_15 AC 52 ms
11,012 KB
testcase_16 AC 53 ms
11,012 KB
testcase_17 AC 51 ms
11,012 KB
testcase_18 AC 51 ms
11,012 KB
testcase_19 AC 54 ms
11,012 KB
testcase_20 AC 51 ms
11,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MAX=200200;
const int MOD=998244353;
ll fac[MAX],finv[MAX],inv[MAX];

void init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  init();
  int n;
  cin>>n;
  vector<int> X(n),Y(n);
  rep(i,n) cin>>X[i];
  rep(i,n) cin>>Y[i];
  vector<pair<int,int>> A;
  rep(i,n) A.push_back({X[i],0});
  rep(i,n) A.push_back({Y[i],1});
  sort(ALL(A));
  ll cx=0,cy=0;
  rep(i,n){
    if(A[i].second==0) cx++;
    else cy++;
  }
  cout<<fac[cx]*fac[cy]%MOD<<endl;
    
  return 0;
}
0