結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2025-02-20 00:12:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,198 bytes |
コンパイル時間 | 3,546 ms |
コンパイル使用メモリ | 279,116 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-20 00:13:00 |
合計ジャッジ時間 | 4,848 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 WA * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,a,n) for (int i=a;i<n;i++) #define per(i,a,n) for (int i=n-1;i>=a;i--) #define pb push_back #define eb emplace_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) typedef vector<int> VI; typedef long long ll; typedef pair<int,int> PII; typedef double db; mt19937 mrand(random_device{}()); const ll mod=998244353; int rnd(int x) { return mrand() % x;} ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} // head int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int N; cin >> N; VI A(N), B(N), ord(N); rep(i, 0, N) cin >> A[i]; rep(i, 0, N) cin >> B[i]; iota(all(ord), 0); int cnt = 0, a_cnt = 0; do { int a_win = 0, b_win = 0; rep(i, 0, N) { a_win += A[ord[i]] > B[i]; b_win += B[ord[i]] < B[i]; } a_cnt += a_win > b_win; ++cnt; } while (next_permutation(all(ord))); cout << (double)a_cnt / cnt << endl; return 0; }