結果
問題 | No.2615 ペアの作り方 |
ユーザー |
![]() |
提出日時 | 2022-02-05 19:14:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 92 ms / 2,000 ms |
コード長 | 685 bytes |
コンパイル時間 | 882 ms |
コンパイル使用メモリ | 73,472 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-09-28 07:32:21 |
合計ジャッジ時間 | 2,711 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>#define int long longusing namespace std;typedef pair<int, char> P;const int mod = 998244353;int n;P pa[200000];int fact[100001];signed main() {int i;cin >> n;fact[0] = 1;for (i = 1; i <= n; i++) {fact[i] = fact[i - 1] * i % mod;}for (i = 0; i < n; i++) {int x;cin >> x;pa[i] = P(x, 'x');}for (i = 0; i < n; i++) {int y;cin >> y;pa[n + i] = P(y, 'y');}sort(pa, pa + 2 * n);int cntx = 0;int cnty = 0;for (i = 0; i < n; i++) {if (pa[i].second == 'x') {cntx++;}else {cnty++;}}cout << fact[cntx] * fact[cnty] % mod << endl;return 0;}