結果

問題 No.1825 Except One
ユーザー first_vilfirst_vil
提出日時 2022-01-28 22:33:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 3,000 ms
コード長 903 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 77,668 KB
最終ジャッジ日時 2023-08-30 11:11:02
合計ジャッジ時間 6,991 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
76,720 KB
testcase_01 AC 93 ms
76,752 KB
testcase_02 AC 93 ms
76,436 KB
testcase_03 AC 171 ms
77,416 KB
testcase_04 AC 145 ms
77,260 KB
testcase_05 AC 125 ms
76,964 KB
testcase_06 AC 114 ms
77,480 KB
testcase_07 AC 180 ms
77,100 KB
testcase_08 AC 176 ms
77,148 KB
testcase_09 AC 112 ms
77,408 KB
testcase_10 AC 153 ms
77,064 KB
testcase_11 AC 138 ms
77,120 KB
testcase_12 AC 159 ms
77,248 KB
testcase_13 AC 142 ms
77,028 KB
testcase_14 AC 100 ms
76,736 KB
testcase_15 AC 120 ms
77,200 KB
testcase_16 AC 112 ms
77,284 KB
testcase_17 AC 108 ms
77,464 KB
testcase_18 AC 97 ms
76,636 KB
testcase_19 AC 107 ms
77,164 KB
testcase_20 AC 106 ms
77,112 KB
testcase_21 AC 108 ms
77,456 KB
testcase_22 AC 112 ms
77,488 KB
testcase_23 AC 118 ms
77,160 KB
testcase_24 AC 147 ms
77,260 KB
testcase_25 AC 141 ms
77,400 KB
testcase_26 AC 122 ms
77,348 KB
testcase_27 AC 165 ms
77,420 KB
testcase_28 AC 171 ms
77,588 KB
testcase_29 AC 113 ms
77,668 KB
testcase_30 AC 120 ms
77,520 KB
testcase_31 AC 125 ms
77,052 KB
testcase_32 AC 179 ms
77,276 KB
testcase_33 AC 121 ms
77,468 KB
testcase_34 AC 165 ms
77,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
mod = int(1e9 + 7)
# mod = 998244353

n = ii()
a = li()
A = 200
ans = 0
for k in range(A + 1):
    dp = [[0] * (k + 1) for m in range(3)]
    dp[0][k] = 1
    for i in range(n):
        nxt = [[0] * (k + 1) for m in range(3)]
        for m in range(3):
            p = m + 1 if m + 1 <= 2 else 2
            for j in range(k + 1):
                nxt[m][j] += dp[m][j]
                if a[i] - k <= 0 and 0 <= j + a[i] - k:
                    nxt[p][j + a[i] - k] += dp[m][j]
        dp = nxt
    ans += dp[2][0]
print(ans)
0