結果
問題 |
No.133 カードゲーム
|
ユーザー |
|
提出日時 | 2020-08-06 14:36:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 669 bytes |
コンパイル時間 | 1,649 ms |
コンパイル使用メモリ | 172,212 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 16:51:40 |
合計ジャッジ時間 | 2,618 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 1 WA * 18 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){ //input int n; cin>>n; vector<int>a(n); vector<int>b(n); for(int i=0;i<n;i++)cin>>a[i]>>b[i]; sort(a.begin(),a.end());//next_permutationで全順列を出すときは昇順である必要があるらしい //nが4までなのでaの全順列を列挙し比較 double ans; int wingame=0; int cntgame=0; do{ int wincard=0; for(int i=0;i<n;i++){ if(a[i]>b[i])wincard++; else wincard--;} if(wincard>0) wingame++; cntgame++;} while(next_permutation(a.begin(),a.end())); ans=wingame/cntgame; //output cout<<ans<<endl; return 0;}