結果

問題 No.1471 Sort Queries
ユーザー kohei2019kohei2019
提出日時 2022-05-21 19:11:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 78,556 KB
最終ジャッジ日時 2023-10-20 16:33:10
合計ジャッジ時間 6,480 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,540 KB
testcase_01 AC 35 ms
53,540 KB
testcase_02 AC 34 ms
53,540 KB
testcase_03 AC 39 ms
59,628 KB
testcase_04 AC 36 ms
53,540 KB
testcase_05 AC 35 ms
53,540 KB
testcase_06 AC 34 ms
53,540 KB
testcase_07 AC 33 ms
53,540 KB
testcase_08 AC 39 ms
59,652 KB
testcase_09 AC 36 ms
59,628 KB
testcase_10 AC 35 ms
53,540 KB
testcase_11 AC 35 ms
53,540 KB
testcase_12 AC 40 ms
59,844 KB
testcase_13 AC 77 ms
77,572 KB
testcase_14 AC 76 ms
77,252 KB
testcase_15 AC 79 ms
77,488 KB
testcase_16 AC 77 ms
76,852 KB
testcase_17 AC 75 ms
77,296 KB
testcase_18 AC 71 ms
73,988 KB
testcase_19 AC 77 ms
76,788 KB
testcase_20 AC 80 ms
77,528 KB
testcase_21 AC 78 ms
77,356 KB
testcase_22 AC 71 ms
74,656 KB
testcase_23 AC 89 ms
78,528 KB
testcase_24 AC 87 ms
78,556 KB
testcase_25 AC 89 ms
77,176 KB
testcase_26 AC 85 ms
78,180 KB
testcase_27 AC 85 ms
77,736 KB
testcase_28 AC 88 ms
77,732 KB
testcase_29 AC 87 ms
78,280 KB
testcase_30 AC 84 ms
78,532 KB
testcase_31 AC 90 ms
77,192 KB
testcase_32 AC 90 ms
77,208 KB
testcase_33 AC 86 ms
77,160 KB
testcase_34 AC 90 ms
77,164 KB
testcase_35 AC 91 ms
77,156 KB
testcase_36 AC 86 ms
77,060 KB
testcase_37 AC 85 ms
77,060 KB
testcase_38 AC 84 ms
77,168 KB
testcase_39 AC 82 ms
77,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q = map(int,input().split())
S = input()
lsalpha = 'abcdefghijklmnopqrstuvwxyz'
d = dict()
for i in range(26):
    d[lsalpha[i]] = i
ll = []
for i in range(N):
    ll.append(d[S[i]])
lsQ = []
for i in range(Q):
    l,r,x = map(int,input().split())
    l -= 1
    lsQ.append((l,r,x))

la = [[0]*(N+1) for i in range(26)]
for i in range(26):
    for j in range(N):
        la[i][j+1] = la[i][j]+(i==ll[j])

for i in range(Q):
    l,r,x = lsQ[i]
    c = 0
    v = 0
    for j in range(26):
        c += la[j][r]-la[j][l]
        if c >= x:
            v = j
            break
    print(lsalpha[v])
0