結果

問題 No.1263 ご注文は数学ですか?
ユーザー kozykozy
提出日時 2020-10-12 18:06:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,049 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 8,372 KB
最終ジャッジ日時 2023-09-27 23:47:36
合計ジャッジ時間 906 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def kokanzeta(L,hugou,ima,keisu):
    if len(L)==2:
        a,b=L
        if ima+" "+str(a)+" "+str(b) not in c:
            c[ima+" "+str(a)+" "+str(b)]=hugou*keisu/2
        else:
            c[ima+" "+str(a)+" "+str(b)]+=hugou*keisu/2
        if ima+" "+str(a+b) not in c:
            c[ima+" "+str(a+b)]=(-1)*hugou*keisu/2
        else:
            c[ima+" "+str(a+b)]+=(-1)*hugou*keisu/2
        return 1
    else:
        S=len(L)
        a=L[-1]
        K=[i for i in L]
        K=K[:-1]
        kokanzeta(K,hugou,ima+" "+str(a),keisu)
        for i in range(S-1):
            K=[i for i in L]
            K=K[:-1]
            K[i]+=a
            kokanzeta(K,hugou*(-1),ima,keisu)

#文字数ばれしないためにここで文字数を稼ぐ
mod=1000000007
x=int(input())
c=dict()
Q=[2]*x
kokanzeta(Q,1,str(),2)
p=list()
sc=list()
for i in c:
  s=i
  s="1"+s
  L=list(map(int,s.split()))
  L=L[1:]
  L=sorted(L)
  if L not in p:
    p.append(L)
    sc.append(c[i])
  else:
    sc[p.index(L)]+=c[i]
ans=1
for i in sc:
  ans*=i
print(ans%mod)
0