結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2024-05-29 14:02:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 729 bytes |
コンパイル時間 | 1,853 ms |
コンパイル使用メモリ | 173,392 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-20 21:01:33 |
合計ジャッジ時間 | 2,761 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main() {int N;cin >> N;vector<int> A(N), B(N);for (int i = 0; i < N; i++) {cin >> A[i];}for (int i = 0; i < N; i++) {cin >> B[i];}sort(A.begin(), A.end());sort(B.begin(), B.end());int count = 0;do {do {int A_count = 0;for (int i = 0; i < N; i++) {if (A[i] > B[i]) {A_count++;}}if (A_count > N / 2) {count++;}} while (next_permutation(A.begin(), A.end()));} while (next_permutation(B.begin(), B.end()));int fact = 1;for (int i = 1; i <= N; i++) {fact *= i;}cout << count / pow(fact, 2) << endl;}