結果

問題 No.1471 Sort Queries
ユーザー titiatitia
提出日時 2021-04-09 23:54:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 11,472 KB
最終ジャッジ日時 2023-09-07 18:52:58
合計ジャッジ時間 5,951 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,752 KB
testcase_01 AC 15 ms
7,812 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 18 ms
7,780 KB
testcase_04 AC 17 ms
7,804 KB
testcase_05 AC 16 ms
7,864 KB
testcase_06 AC 16 ms
7,848 KB
testcase_07 AC 16 ms
7,808 KB
testcase_08 AC 17 ms
7,808 KB
testcase_09 AC 16 ms
7,880 KB
testcase_10 AC 16 ms
7,808 KB
testcase_11 AC 17 ms
7,864 KB
testcase_12 AC 17 ms
7,892 KB
testcase_13 AC 82 ms
9,452 KB
testcase_14 AC 74 ms
9,392 KB
testcase_15 AC 105 ms
9,468 KB
testcase_16 AC 62 ms
8,520 KB
testcase_17 AC 69 ms
9,444 KB
testcase_18 AC 57 ms
9,220 KB
testcase_19 AC 62 ms
8,644 KB
testcase_20 AC 108 ms
9,432 KB
testcase_21 AC 71 ms
9,132 KB
testcase_22 AC 64 ms
9,404 KB
testcase_23 AC 148 ms
10,576 KB
testcase_24 AC 141 ms
10,448 KB
testcase_25 AC 190 ms
10,552 KB
testcase_26 AC 139 ms
9,800 KB
testcase_27 AC 171 ms
11,168 KB
testcase_28 AC 172 ms
11,136 KB
testcase_29 AC 137 ms
9,812 KB
testcase_30 AC 141 ms
10,344 KB
testcase_31 AC 184 ms
10,268 KB
testcase_32 AC 187 ms
9,644 KB
testcase_33 AC 222 ms
11,180 KB
testcase_34 AC 231 ms
11,160 KB
testcase_35 AC 232 ms
11,148 KB
testcase_36 AC 224 ms
11,196 KB
testcase_37 AC 224 ms
11,180 KB
testcase_38 AC 197 ms
11,472 KB
testcase_39 AC 228 ms
11,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,Q=map(int,input().split())
S=input().strip()

X=[[0]*26 for i in range(len(S)+1)]
for i in range(len(S)):
    x=ord(S[i])-97
    for j in range(26):
        X[i][j]=X[i-1][j]
        
    X[i][x]+=1

#print(X)

for q in range(Q):
    l,r,x=map(int,input().split())
    l-=1
    r-=1
    Y=[0]*26
    for j in range(26):
        Y[j]+=X[r][j]
        Y[j]-=X[l-1][j]

    now=0
    for j in range(26):
        now+=Y[j]
        if now>=x:
            print(chr(97+j))
            break
    
0