結果

問題 No.2615 ペアの作り方
ユーザー tobbietobbie
提出日時 2024-05-06 23:03:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 627 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 175,676 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-06 23:03:11
合計ジャッジ時間 4,144 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 998244353
using ll = long long int;

int factorial (int x) {
  int ret = 1;
  while (x > 1) {
    ret = ((ll)ret * (ll)x) % MOD;
    x--;
  }
  return ret;
}

int main() {
  int N;
  cin >> N;
  vector<int> X(N), Y(N);
  rep(i, N) cin >> X[i];
  rep(i, N) cin >> Y[i];
  sort(X.begin(), X.end());
  sort(Y.rbegin(), Y.rend());
  int mid = -1;
  rep(i, N)
    if (X[i] >= Y[i]) {
      mid = i;
      break;
    }
  int ans = ((ll)factorial(mid) * (ll)factorial(N - mid)) % MOD;
  cout << ans << endl;
  return 0;
}
0