結果

問題 No.1471 Sort Queries
ユーザー brthyyjpbrthyyjp
提出日時 2021-04-09 21:34:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 561 bytes
コンパイル時間 476 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 80,036 KB
最終ジャッジ日時 2023-09-07 10:11:49
合計ジャッジ時間 5,508 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,260 KB
testcase_01 AC 72 ms
71,220 KB
testcase_02 AC 70 ms
71,436 KB
testcase_03 AC 74 ms
75,776 KB
testcase_04 AC 71 ms
71,320 KB
testcase_05 AC 72 ms
71,220 KB
testcase_06 AC 70 ms
71,200 KB
testcase_07 AC 69 ms
71,584 KB
testcase_08 AC 75 ms
75,852 KB
testcase_09 AC 74 ms
75,736 KB
testcase_10 AC 69 ms
71,296 KB
testcase_11 AC 71 ms
71,260 KB
testcase_12 AC 74 ms
75,948 KB
testcase_13 AC 88 ms
76,780 KB
testcase_14 AC 93 ms
76,948 KB
testcase_15 AC 95 ms
76,888 KB
testcase_16 AC 90 ms
77,504 KB
testcase_17 AC 87 ms
76,644 KB
testcase_18 AC 89 ms
76,740 KB
testcase_19 AC 89 ms
76,928 KB
testcase_20 AC 89 ms
76,924 KB
testcase_21 AC 88 ms
77,388 KB
testcase_22 AC 87 ms
77,008 KB
testcase_23 AC 94 ms
76,720 KB
testcase_24 AC 97 ms
76,772 KB
testcase_25 AC 100 ms
79,168 KB
testcase_26 AC 94 ms
76,888 KB
testcase_27 AC 100 ms
80,036 KB
testcase_28 AC 102 ms
79,956 KB
testcase_29 AC 96 ms
76,860 KB
testcase_30 AC 90 ms
76,832 KB
testcase_31 AC 98 ms
78,984 KB
testcase_32 AC 100 ms
78,768 KB
testcase_33 AC 103 ms
79,996 KB
testcase_34 AC 101 ms
80,000 KB
testcase_35 AC 102 ms
80,028 KB
testcase_36 AC 102 ms
79,456 KB
testcase_37 AC 102 ms
80,028 KB
testcase_38 AC 99 ms
79,312 KB
testcase_39 AC 95 ms
79,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import io, os
input = sys.stdin.readline

n, q = map(int, input().split())
s = input().rstrip()
#print(s)
C = [[0]*(n+1) for i in range(26)]
for i, c in enumerate(s):
    C[ord(c)-ord('a')][i+1] += 1
for j in range(26):
    for i in range(1, n+1):
        C[j][i] += C[j][i-1]
#print(C[0])
for i in range(q):
    l, r, x = map(int, input().split())
    l, r = l-1, r-1
    cnt = 0
    for j in range(26):
        cnt += C[j][r+1]-C[j][l]
        if cnt >= x:
            p = j
            break
    #print(p)
    ans = chr(p+ord('a'))
    print(ans)
0