結果

問題 No.2055 12x34...
ユーザー shotoyooshotoyoo
提出日時 2022-08-21 13:24:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 804 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 125,252 KB
最終ジャッジ日時 2024-04-18 12:52:19
合計ジャッジ時間 5,768 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
54,272 KB
testcase_01 AC 39 ms
53,760 KB
testcase_02 AC 61 ms
72,832 KB
testcase_03 AC 75 ms
86,528 KB
testcase_04 AC 85 ms
98,304 KB
testcase_05 AC 89 ms
101,120 KB
testcase_06 AC 81 ms
96,256 KB
testcase_07 AC 78 ms
88,832 KB
testcase_08 AC 66 ms
81,152 KB
testcase_09 AC 92 ms
101,120 KB
testcase_10 AC 94 ms
104,576 KB
testcase_11 AC 64 ms
79,360 KB
testcase_12 AC 104 ms
107,520 KB
testcase_13 AC 131 ms
104,448 KB
testcase_14 AC 85 ms
92,928 KB
testcase_15 AC 81 ms
92,928 KB
testcase_16 AC 146 ms
125,252 KB
testcase_17 AC 77 ms
90,904 KB
testcase_18 AC 102 ms
101,632 KB
testcase_19 AC 60 ms
74,240 KB
testcase_20 AC 53 ms
67,584 KB
testcase_21 AC 59 ms
74,368 KB
testcase_22 AC 128 ms
110,140 KB
testcase_23 AC 120 ms
107,136 KB
testcase_24 AC 133 ms
110,544 KB
testcase_25 AC 129 ms
107,136 KB
testcase_26 AC 127 ms
107,136 KB
testcase_27 AC 133 ms
110,284 KB
testcase_28 AC 130 ms
107,264 KB
testcase_29 AC 136 ms
110,212 KB
testcase_30 AC 128 ms
106,880 KB
testcase_31 AC 127 ms
107,136 KB
testcase_32 AC 127 ms
107,136 KB
testcase_33 AC 103 ms
105,928 KB
testcase_34 AC 98 ms
105,728 KB
testcase_35 AC 100 ms
105,856 KB
testcase_36 AC 98 ms
105,728 KB
testcase_37 AC 98 ms
105,704 KB
testcase_38 AC 99 ms
105,472 KB
testcase_39 AC 99 ms
105,600 KB
testcase_40 AC 99 ms
105,472 KB
testcase_41 AC 99 ms
105,472 KB
testcase_42 AC 99 ms
105,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input())
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

n = int(input())
a = list(map(int, input().split()))
M = 998244353
d = {}
for v in a:
    d.setdefault(v,0)
    d[v] += 1 + d.get(v-1,0)
    d[v] %= M
ans = 0
for k,v in d.items():
    ans += v
    ans %= M
print((ans-n)%M)
0