結果
問題 |
No.133 カードゲーム
|
ユーザー |
|
提出日時 | 2024-02-19 13:28:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 519 bytes |
コンパイル時間 | 593 ms |
コンパイル使用メモリ | 72,832 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-29 01:09:21 |
合計ジャッジ時間 | 1,297 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include<iostream> #include<algorithm> #include<vector> using namespace std; int main() { int N; cin >> N; vector<int> A(N), B(N), C(N); for(int i=0; i<N; i++) cin >> A[i]; for(int i=0; i<N; i++) cin >> B[i]; for(int i=0; i<N; i++) C[i] = i; int match = 0, res = 0; do { int sa = 0, sb = 0; for(int i=0; i<N; i++) { if(A[i] > B[C[i]]) sa++; else sb++; } if(sa > sb) res++; match++; } while(next_permutation(C.begin(), C.end())); cout << (double)res/match << endl; }