結果

問題 No.2561 みんな大好きmod 998
ユーザー n_nan_na
提出日時 2024-01-02 23:08:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 958 ms / 4,000 ms
コード長 662 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 80,248 KB
最終ジャッジ日時 2024-01-02 23:09:15
合計ジャッジ時間 16,072 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 249 ms
77,964 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 932 ms
79,628 KB
testcase_04 AC 889 ms
79,232 KB
testcase_05 AC 876 ms
79,232 KB
testcase_06 AC 905 ms
79,232 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 34 ms
53,460 KB
testcase_09 AC 83 ms
76,068 KB
testcase_10 AC 35 ms
53,460 KB
testcase_11 AC 285 ms
77,680 KB
testcase_12 AC 36 ms
53,460 KB
testcase_13 AC 35 ms
53,460 KB
testcase_14 AC 36 ms
53,460 KB
testcase_15 AC 958 ms
79,744 KB
testcase_16 AC 35 ms
53,460 KB
testcase_17 AC 35 ms
53,460 KB
testcase_18 AC 40 ms
59,336 KB
testcase_19 AC 813 ms
80,248 KB
testcase_20 AC 46 ms
61,984 KB
testcase_21 AC 38 ms
53,460 KB
testcase_22 AC 34 ms
53,460 KB
testcase_23 AC 39 ms
59,332 KB
testcase_24 AC 34 ms
53,460 KB
testcase_25 AC 34 ms
53,460 KB
testcase_26 AC 347 ms
77,296 KB
testcase_27 AC 870 ms
79,232 KB
testcase_28 AC 391 ms
77,304 KB
testcase_29 AC 233 ms
77,276 KB
testcase_30 AC 400 ms
77,944 KB
testcase_31 AC 578 ms
79,240 KB
testcase_32 AC 225 ms
76,544 KB
testcase_33 AC 238 ms
77,276 KB
testcase_34 AC 951 ms
79,232 KB
testcase_35 AC 173 ms
76,404 KB
testcase_36 AC 174 ms
76,404 KB
testcase_37 AC 142 ms
76,416 KB
testcase_38 AC 289 ms
77,680 KB
testcase_39 AC 437 ms
77,944 KB
testcase_40 AC 401 ms
77,944 KB
testcase_41 AC 280 ms
77,680 KB
testcase_42 AC 391 ms
77,304 KB
testcase_43 AC 143 ms
76,416 KB
testcase_44 AC 253 ms
77,552 KB
testcase_45 AC 727 ms
78,712 KB
testcase_46 AC 184 ms
76,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)

#-------------------
def rec(per):
    global ans
    
    if len(per) == K:
        t1,t2 = 0,0
        for x in per:
            t1 += A[x]
            t1 %= m1
            t2 += A[x]
            t2 %= m2
        if t2 <= t1:
            ans += 1
            ans %= m1
        return
    
    lst = per[-1]
    if lst == N-1:
        return
    
    for nxt in range(lst+1, N, 1):
        per.append(nxt)
        rec(per[:])
        per.pop()

#-------------------
m1 = 998
m2 = 998244353

N,K = map(int,input().split())
A = list(map(int,input().split()))

ans = 0
for i in range(N):
    P = [i]
    rec(P)

print(ans)
0