結果

問題 No.1471 Sort Queries
ユーザー DrDrpilotDrDrpilot
提出日時 2022-06-08 13:51:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 11,820 KB
実行使用メモリ 14,828 KB
最終ジャッジ日時 2023-10-21 04:01:51
合計ジャッジ時間 6,719 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,060 KB
testcase_01 AC 30 ms
10,060 KB
testcase_02 AC 31 ms
10,060 KB
testcase_03 AC 31 ms
10,060 KB
testcase_04 AC 31 ms
10,068 KB
testcase_05 AC 30 ms
10,060 KB
testcase_06 AC 30 ms
10,064 KB
testcase_07 AC 31 ms
10,064 KB
testcase_08 AC 32 ms
10,060 KB
testcase_09 AC 31 ms
10,068 KB
testcase_10 AC 30 ms
10,064 KB
testcase_11 AC 31 ms
10,064 KB
testcase_12 AC 32 ms
10,060 KB
testcase_13 AC 109 ms
11,004 KB
testcase_14 AC 103 ms
10,864 KB
testcase_15 AC 128 ms
10,908 KB
testcase_16 AC 73 ms
10,272 KB
testcase_17 AC 96 ms
10,924 KB
testcase_18 AC 86 ms
10,812 KB
testcase_19 AC 77 ms
10,352 KB
testcase_20 AC 127 ms
10,928 KB
testcase_21 AC 97 ms
10,816 KB
testcase_22 AC 91 ms
10,812 KB
testcase_23 AC 188 ms
12,512 KB
testcase_24 AC 189 ms
12,604 KB
testcase_25 AC 236 ms
13,032 KB
testcase_26 AC 166 ms
11,208 KB
testcase_27 AC 239 ms
14,652 KB
testcase_28 AC 235 ms
14,460 KB
testcase_29 AC 161 ms
11,264 KB
testcase_30 AC 182 ms
12,352 KB
testcase_31 AC 214 ms
11,924 KB
testcase_32 AC 202 ms
10,928 KB
testcase_33 AC 265 ms
14,828 KB
testcase_34 AC 289 ms
14,804 KB
testcase_35 AC 288 ms
14,800 KB
testcase_36 AC 256 ms
14,784 KB
testcase_37 AC 259 ms
14,764 KB
testcase_38 AC 207 ms
12,392 KB
testcase_39 AC 261 ms
14,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

alp='abcdefghijklmnopqrstuvwxyz'
n,q=map(int,input().split())
s=input()
cnt=[[0]*(n+1) for _ in range(26)]
for i in range(26):
    ch=alp[i]
    for j in range(n):
        if s[j]==ch:
            cnt[i][j+1]+=1
for i in range(26):
    for j in range(n):
        cnt[i][j+1]+=cnt[i][j]
for _ in range(q):
    l,r,x=map(int,input().split())
    tmp=0
    for i in range(26):
        tmp+=cnt[i][r]-cnt[i][l-1]
        if tmp>=x:
            print(alp[i])
            break
0