結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2019-04-04 12:42:48 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 965 bytes |
コンパイル時間 | 12,715 ms |
コンパイル使用メモリ | 223,080 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 21:07:09 |
合計ジャッジ時間 | 13,684 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
package mainimport "fmt"func main() {var n, a int_, _ = fmt.Scan(&n)aCards := make([]int, n)for i := range aCards {_, _ = fmt.Scan(&a)aCards[i] = a}bCards := make([]int, n)for i := range bCards {_, _ = fmt.Scan(&a)bCards[i] = a}pattern := [][]int{{}}for i := 0; i < n; i++ {tmp := make([][]int, 0)for j := 0; j < n; j++ {for _, p := range pattern {contains := falsefor _, q := range p {if q == j {contains = truebreak}}if !contains {q := make([]int, len(p))copy(q, p)tmp = append(tmp, append(q, j))}}}pattern = tmp}ans := 0for _, aP := range pattern {for _, bP := range pattern {win := 0for j := 0; j < n; j++ {if aCards[aP[j]] > bCards[bP[j]] {win++}}if win > n/2 {// fmt.Println(win, aP, bP)ans++}}}fmt.Printf("%.4f\n", float64(ans)/float64(len(pattern)*len(pattern)))}