結果

問題 No.2611 Count 01
ユーザー anonymouslyanonymously
提出日時 2024-01-19 22:09:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 499 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 18,068 KB
最終ジャッジ日時 2024-01-19 22:10:02
合計ジャッジ時間 8,332 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,112 KB
testcase_01 AC 32 ms
10,112 KB
testcase_02 AC 31 ms
10,112 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
M=998244353
N,Q=map(int,input().split())
S=list(input())
for q in range(Q):
    query=[int(_)for _ in input().split()]
    if query[0]==1:
        i=query[1]-1
        if S[i]=='0':
            S[i]='1'
        elif S[i]=='1':
            S[i]='0'
    elif query[0]==2:
        L=query[1]-1
        R=query[2]-1
        A=0
        for l in range(L,R):
            for r in range(l+2,R+2):
                A+=S[l:r].count('0')*S[l:r].count('1')
                A%=M
        print(A)
0