結果

問題 No.1471 Sort Queries
ユーザー O2MTO2MT
提出日時 2021-04-18 19:28:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,356 KB
実行使用メモリ 88,776 KB
最終ジャッジ日時 2023-09-17 08:01:24
合計ジャッジ時間 9,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
72,592 KB
testcase_01 AC 108 ms
72,912 KB
testcase_02 AC 115 ms
72,804 KB
testcase_03 AC 114 ms
72,616 KB
testcase_04 AC 112 ms
72,656 KB
testcase_05 AC 111 ms
72,652 KB
testcase_06 AC 112 ms
72,456 KB
testcase_07 AC 112 ms
72,668 KB
testcase_08 AC 116 ms
77,368 KB
testcase_09 AC 108 ms
72,624 KB
testcase_10 AC 110 ms
72,456 KB
testcase_11 AC 108 ms
72,736 KB
testcase_12 AC 112 ms
72,884 KB
testcase_13 AC 188 ms
80,512 KB
testcase_14 AC 164 ms
80,424 KB
testcase_15 AC 174 ms
80,684 KB
testcase_16 AC 170 ms
80,868 KB
testcase_17 AC 164 ms
80,512 KB
testcase_18 AC 162 ms
80,540 KB
testcase_19 AC 166 ms
80,380 KB
testcase_20 AC 177 ms
80,564 KB
testcase_21 AC 170 ms
81,224 KB
testcase_22 AC 165 ms
80,532 KB
testcase_23 AC 206 ms
86,480 KB
testcase_24 AC 203 ms
86,608 KB
testcase_25 AC 216 ms
87,316 KB
testcase_26 AC 208 ms
84,900 KB
testcase_27 AC 217 ms
88,492 KB
testcase_28 AC 210 ms
88,328 KB
testcase_29 AC 201 ms
85,484 KB
testcase_30 AC 189 ms
86,212 KB
testcase_31 AC 216 ms
85,968 KB
testcase_32 AC 215 ms
85,208 KB
testcase_33 AC 217 ms
88,580 KB
testcase_34 AC 227 ms
88,616 KB
testcase_35 AC 226 ms
88,776 KB
testcase_36 AC 210 ms
88,368 KB
testcase_37 AC 208 ms
88,684 KB
testcase_38 AC 206 ms
83,524 KB
testcase_39 AC 199 ms
85,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter, deque
from copy import copy
N,Q = map(int,input().split())
S = list(str(input()))
alp = list('abcdefghijklmnopqrstuvwxyz')
s = Counter(sorted(S))
C = deque([copy(s)])

for i in range(N-1,-1,-1):
    s[S[i]] -= 1
    C.appendleft(copy(s))

for _ in range(Q):
    l,r,x = map(int,input().split())
    a,b = C[l-1],C[r]
    count = 0
    for p in alp:
        count += b[p]-a[p]
        if count >= x:
            print(p)
            break
0