結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2023-03-02 07:02:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,340 bytes |
コンパイル時間 | 2,346 ms |
コンパイル使用メモリ | 199,000 KB |
最終ジャッジ日時 | 2025-02-11 00:58:31 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>#define ALL(a) begin(a), end(a)#define REP(i, n) for (int i = 0; i < static_cast<int>(n); ++i)using ll = long long;using ld = long double;using byte = unsigned char;using int128_t = __int128_t;using uint128_t = __uint128_t;using namespace std;constexpr int IINF = 1e9 + 1;constexpr ll LINF = 1e18 + 1;// ================ Comment ================//// =========================================int main(int argc, char **argv){int N;cin >> N;vector<int> A(N), B(N);for (auto i = 0; N > i; i++) {cin >> A[i];}for (auto i = 0; N > i; i++) {cin >> B[i];}sort(ALL(A));sort(ALL(B));auto n_game_Awin = 0;auto n_games = 0;do {do {auto n_turn_Awin = 0;auto n_turn_Bwin = 0;for (auto i = 0; N > i; i++) {if (A[i] > B[i]) {n_turn_Awin++;}else {n_turn_Bwin++;}}if (n_turn_Awin > n_turn_Bwin) {n_game_Awin++;}n_games++;} while (next_permutation(ALL(B)));} while (next_permutation(ALL(A)));cout << setprecision(15) << (double)n_game_Awin / n_games << endl;return EXIT_SUCCESS;}