結果
| 問題 |
No.2615 ペアの作り方
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-17 01:48:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 618 bytes |
| コンパイル時間 | 2,017 ms |
| コンパイル使用メモリ | 200,480 KB |
| 実行使用メモリ | 8,560 KB |
| 最終ジャッジ日時 | 2025-03-17 01:48:36 |
| 合計ジャッジ時間 | 3,973 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include<bits/stdc++.h>
#define int long long
#define matsuri pair<int,int>
//const int iris = 1e9+7;
const int iris = 998244353;
using namespace std;
void solve()
{
int n;
cin>>n;
vector<matsuri> arr;
for(int i=0;i<n*2;i++)
{
int a;
cin>>a;
arr.emplace_back(a, i<n);
}
sort(arr.begin(), arr.end());
int cnt=0;
for(int i=0;i<n;i++)
cnt+=arr[i].second;
auto f=[&](int a)
{
int res=1;
for(int i=2;i<=a;i++)
res=res*i%iris;
return res;
};
cout<<f(cnt)*f(n-cnt)%iris<<'\n';
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T=1;
//cin>>T;
while(T--)
solve();
return 0;
}