結果

問題 No.1740 Alone 'a'
ユーザー vwxyzvwxyz
提出日時 2023-02-02 04:36:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 998 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 12,428 KB
最終ジャッジ日時 2023-09-14 13:24:03
合計ジャッジ時間 5,979 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,372 KB
testcase_01 AC 34 ms
10,372 KB
testcase_02 AC 33 ms
10,400 KB
testcase_03 AC 177 ms
12,428 KB
testcase_04 AC 180 ms
12,328 KB
testcase_05 AC 38 ms
10,564 KB
testcase_06 AC 37 ms
10,432 KB
testcase_07 AC 34 ms
10,540 KB
testcase_08 AC 34 ms
10,388 KB
testcase_09 AC 33 ms
10,368 KB
testcase_10 AC 33 ms
10,476 KB
testcase_11 AC 53 ms
10,760 KB
testcase_12 AC 121 ms
11,868 KB
testcase_13 AC 107 ms
11,700 KB
testcase_14 AC 140 ms
12,040 KB
testcase_15 AC 35 ms
10,356 KB
testcase_16 AC 114 ms
11,640 KB
testcase_17 AC 34 ms
10,384 KB
testcase_18 AC 48 ms
10,732 KB
testcase_19 AC 132 ms
11,932 KB
testcase_20 AC 78 ms
11,252 KB
testcase_21 AC 96 ms
11,636 KB
testcase_22 AC 112 ms
11,560 KB
testcase_23 AC 114 ms
11,736 KB
testcase_24 AC 81 ms
11,336 KB
testcase_25 AC 84 ms
11,196 KB
testcase_26 AC 95 ms
11,664 KB
testcase_27 AC 92 ms
11,396 KB
testcase_28 AC 92 ms
11,364 KB
testcase_29 AC 145 ms
11,988 KB
testcase_30 AC 91 ms
11,436 KB
testcase_31 AC 112 ms
11,644 KB
testcase_32 AC 89 ms
11,352 KB
testcase_33 AC 112 ms
11,696 KB
testcase_34 AC 48 ms
10,884 KB
testcase_35 AC 86 ms
11,336 KB
testcase_36 AC 81 ms
11,332 KB
testcase_37 AC 50 ms
10,944 KB
testcase_38 AC 69 ms
11,004 KB
testcase_39 AC 40 ms
10,476 KB
testcase_40 AC 58 ms
10,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write

N=int(readline())
S=[ord(s)-97 for s in readline().rstrip()]
mod=998244353
dp0,dp1=0,0
cnt=0
for s in S:
    dp0,dp1=(dp0*25)%mod,(dp0+dp1*25)%mod
    if s:
        if cnt==0:
            dp1+=1
            dp0+=s-1
        elif cnt==1:
            dp1+=s-1
    if s==0:
        cnt+=1
ans=dp1%mod
print(ans)
0