結果

問題 No.1471 Sort Queries
ユーザー aaaaaaaaaa2230
提出日時 2021-04-09 21:36:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 79,828 KB
最終ジャッジ日時 2024-06-25 04:30:55
合計ジャッジ時間 4,079 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q = map(int,input().split())
S = input()
dp = [[0]*26]
for s in S:
    ndp = [0]*26
    ndp[ord(s)-ord("a")] += 1
    for i in range(26):
        ndp[i] += dp[-1][i]
    dp.append(ndp)

for i in range(q):
    l,r,x = map(int,input().split())
    count = 0
    for j in range(26):
        count += dp[r][j]-dp[l-1][j]
        if count >= x:
            print(chr(ord("a")+j))
            break
0