結果

問題 No.2367 Painting Gascket
ユーザー tassei903tassei903
提出日時 2023-06-30 23:09:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 669 ms / 2,000 ms
コード長 1,052 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 76,912 KB
最終ジャッジ日時 2023-09-21 17:26:16
合計ジャッジ時間 13,129 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,080 KB
testcase_01 AC 74 ms
71,136 KB
testcase_02 AC 85 ms
71,328 KB
testcase_03 AC 73 ms
71,456 KB
testcase_04 AC 74 ms
71,084 KB
testcase_05 AC 74 ms
71,140 KB
testcase_06 AC 73 ms
71,152 KB
testcase_07 AC 75 ms
71,340 KB
testcase_08 AC 669 ms
76,564 KB
testcase_09 AC 476 ms
76,496 KB
testcase_10 AC 95 ms
76,576 KB
testcase_11 AC 598 ms
76,708 KB
testcase_12 AC 97 ms
76,336 KB
testcase_13 AC 240 ms
76,636 KB
testcase_14 AC 164 ms
76,712 KB
testcase_15 AC 164 ms
76,724 KB
testcase_16 AC 289 ms
76,912 KB
testcase_17 AC 617 ms
76,628 KB
testcase_18 AC 503 ms
76,780 KB
testcase_19 AC 343 ms
76,636 KB
testcase_20 AC 606 ms
76,600 KB
testcase_21 AC 380 ms
76,464 KB
testcase_22 AC 636 ms
76,840 KB
testcase_23 AC 491 ms
76,464 KB
testcase_24 AC 243 ms
76,448 KB
testcase_25 AC 259 ms
76,412 KB
testcase_26 AC 118 ms
76,756 KB
testcase_27 AC 521 ms
76,628 KB
testcase_28 AC 445 ms
76,488 KB
testcase_29 AC 77 ms
71,124 KB
testcase_30 AC 75 ms
71,080 KB
testcase_31 AC 77 ms
71,252 KB
testcase_32 AC 77 ms
71,300 KB
testcase_33 AC 83 ms
75,460 KB
testcase_34 AC 82 ms
75,780 KB
testcase_35 AC 520 ms
76,696 KB
testcase_36 AC 666 ms
76,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
k, n = na()

mod = 10**9+7

n1 = n-1
n2 = max(n-2, 0)
n3 = max(n-3, 0)

g = n
g1 = n-1
g11 = n-1
g12 = max(n-2, 0)
g123 = max(n-3, 0)
g112 = max(n-2, 0)
g111 = n-1

#print(g, g1,g11,g12,g111,g112,g123)
for i in range(k):
    h = n * g1 * g1 * g1
    h1 = g11 * g11 * g1 + g12*g12*g1*n1
    h11 = g111*g11*g11+g112*g12*g12*n1
    h111 = g111**3 + n1 * g112**3
    h12 = 2 * g11*g112*g12 + n2 * g123*g12**2
    h112 = g111*g112*g112 + g112**3 + g112*g123*g123*n2
    h123 = 3 * g112 * g112 * g123 + n3 * g123**3
    g = h % mod
    g1 = h1%mod
    g11 = h11 % mod
    g12 = h12 % mod
    g111 = h111 % mod
    g123 = h123 % mod
    g112 = h112 % mod
    #print(g, g1,g11,g12,g111,g112,g123)

print(g)
0