結果

問題 No.1471 Sort Queries
ユーザー NoaSaber
提出日時 2021-04-26 10:16:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 1,120 ms
コンパイル使用メモリ 82,388 KB
実行使用メモリ 88,580 KB
最終ジャッジ日時 2024-07-04 18:50:16
合計ジャッジ時間 9,172 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int,input().split())
S=input()
from collections import Counter
from copy import deepcopy
cum=[Counter() for i in range(N+1)]
for i in range(N):
    cum[i+1]=deepcopy(cum[i])
    cum[i+1][S[i]]+=1
a_l=[chr(i) for i in range(97, 97+26)]
for i in range(Q):
    L,R,X=map(int,input().split())
    tmp_c=cum[R]-cum[L-1]
    tmp=0
    for j in a_l:
        if tmp<=X<=tmp+tmp_c[j]:
            print(j)
            break
        else:
            tmp+=tmp_c[j]
0