結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-22 18:57:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 5,000 ms |
| コード長 | 1,320 bytes |
| コンパイル時間 | 1,367 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2025-05-22 18:58:02 |
| 合計ジャッジ時間 | 2,651 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
import sys
# sys.setrecursionlimit(1000010)
input=lambda:sys.stdin.readline().strip()
# write=lambda x:sys.stdout.write(str(x)+'\n')
I=lambda:input()
II=lambda:int(input())
LI=lambda:list(input())
MII=lambda:map(int,input().split())
LMII=lambda:list(map(int,input().split()))
# from bisect import bisect_left,bisect,insort
from collections import deque,Counter,namedtuple,defaultdict
# from copy import deepcopy
# from decimal import Decimal
# from datetime import datetime,timedelta
from functools import cmp_to_key,reduce,lru_cache
# from fractions import Fraction
from heapq import heapify,heappush,heappop
from itertools import permutations,combinations,accumulate
from math import inf,sqrt,isqrt,gcd,factorial,ceil,floor,e,log,log2,log10,pi,sin,cos,tan,asin,acos,atan,atan2
# from numba import jit
# from operator import or_,xor,add,mul
from random import randint,shuffle,getrandbits
# from sortedcontainers import SortedSet
def solve():
n=II()
a=LMII()
b=LMII()
win=0;cnt=0
for p in permutations(a):
for q in permutations(b):
cnt+=1
c=0
for i in range(n):
if p[i]>q[i]:
c+=1
if c>n-c:
win+=1
print(win/cnt)
return
test=1
# test=int(input())
for _ in range(test):
solve()