結果

問題 No.2615 ペアの作り方
ユーザー 遭難者遭難者
提出日時 2024-01-30 11:03:47
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 1,554 bytes
コンパイル時間 8,649 ms
コンパイル使用メモリ 345,704 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-30 11:03:58
合計ジャッジ時間 10,789 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#else
#pragma GCC target("avx2")
#pragma GCC optimize("Ofast,unroll-loops")
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define ALL(a) a.begin(), a.end()
#define vec vector
#undef long
#define long long long
#define ll long
using namespace std;
using mint = atcoder::modint998244353;
ostream& operator<<(ostream& os, mint a) {
	return os << a.val();
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& a) {
	const int n = a.size();
	rep(i, n) os << a[i] << " \n"[i + 1 == n];
	return os;
}
template<typename T, size_t n>
ostream& operator<<(ostream& os, array<T, n>& a) {
	rep(i, n) os << a[i] << " \n"[i + 1 == n];
	return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& a) {
	for (T& i : a) is >> i;
	return is;
}
template<typename T>
bool chmin(T& x, T y) {
	if (x > y) { x = y; return true; }
	return false;
}
template<typename T>
bool chmax(T& x, T y) {
	if (x < y) { x = y; return true; }
	return false;
}
void solve() {
	int n; cin >> n;
	const int n2 = n << 1;
	vec<int> x(n2);
	rep(j, 2) rep(i, n) {
		int val; cin >> val;
		x[i + n * j] = 2 * val + j;
	}
	sort(ALL(x));
	int odd = 0;
	rep(i, n) odd += x[i] & 1;
	mint ans = 1;
	rep(i, odd) ans *= i + 1;
	rep(i, n - odd) ans *= i + 1;
	cout << ans << endl;
}
int main() {
	// srand((unsigned)time(NULL));
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(40);
	solve();
	return 0;
}
0