結果

問題 No.2615 ペアの作り方
ユーザー cho435cho435
提出日時 2024-01-27 03:16:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 4,926 ms
コンパイル使用メモリ 266,492 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-01-27 03:16:34
合計ジャッジ時間 6,584 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;

int main(){
	int n;
	cin>>n;
	vector<int> x(n),y(n);
	rep(i,n) cin>>x.at(i);
	rep(i,n) cin>>y.at(i);
	sort(x.begin(),x.end());
	reverse(x.begin(),x.end());
	sort(y.begin(),y.end());
	reverse(y.begin(),y.end());
	rep(i,n){
		if(x.back()>y.back()){
			y.pop_back();
		}else{
			x.pop_back();
		}
	}
	vector<mint> fac(n+1);
	fac.at(0)=1;
	for(int i=1;i<=n;i++){
		fac.at(i)=fac.at(i-1)*i;
	}
	cout<<(fac.at(x.size())*fac.at(y.size())).val()<<endl;
}

0