結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-13 00:14:50 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 724 bytes |
| コンパイル時間 | 4,575 ms |
| コンパイル使用メモリ | 66,332 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 00:30:02 |
| 合計ジャッジ時間 | 5,537 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
import strutils, sequtils, algorithm
let N = stdin.readline.parseInt
var
A = stdin.readLine.split.map(parseInt).sorted()
B = stdin.readLine.split.map(parseInt).sorted()
aPerm = newSeq[seq[int]]()
bPerm = newSeq[seq[int]]()
cnt = 0
general_aWin = 0
while true:
aPerm.add(A)
if A.nextPermutation() == false: break
while true:
bPerm.add(B)
if B.nextPermutation() == false: break
for a in aPerm:
for b in bPerm:
inc cnt
var
aWin = 0
bWin = 0
for i in 0..<N:
if a[i] > b[i]:
inc aWin
else:
inc bWin
if aWin > bWin:
inc general_aWin
echo general_aWin/cnt