結果

問題 No.1471 Sort Queries
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-04-09 21:36:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 824 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 80,600 KB
最終ジャッジ日時 2023-09-07 10:17:12
合計ジャッジ時間 6,139 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,404 KB
testcase_01 AC 72 ms
71,472 KB
testcase_02 AC 75 ms
71,400 KB
testcase_03 AC 79 ms
75,044 KB
testcase_04 AC 78 ms
75,280 KB
testcase_05 AC 74 ms
75,400 KB
testcase_06 AC 72 ms
71,368 KB
testcase_07 AC 75 ms
75,404 KB
testcase_08 AC 82 ms
76,176 KB
testcase_09 AC 77 ms
75,160 KB
testcase_10 AC 75 ms
75,256 KB
testcase_11 AC 80 ms
75,344 KB
testcase_12 AC 77 ms
75,420 KB
testcase_13 AC 105 ms
78,748 KB
testcase_14 AC 103 ms
78,396 KB
testcase_15 AC 112 ms
78,652 KB
testcase_16 AC 104 ms
77,568 KB
testcase_17 AC 102 ms
78,580 KB
testcase_18 AC 99 ms
78,568 KB
testcase_19 AC 106 ms
77,700 KB
testcase_20 AC 115 ms
78,848 KB
testcase_21 AC 103 ms
78,680 KB
testcase_22 AC 103 ms
78,524 KB
testcase_23 AC 127 ms
79,384 KB
testcase_24 AC 121 ms
79,200 KB
testcase_25 AC 137 ms
79,960 KB
testcase_26 AC 129 ms
78,820 KB
testcase_27 AC 134 ms
80,336 KB
testcase_28 AC 130 ms
79,676 KB
testcase_29 AC 123 ms
78,736 KB
testcase_30 AC 122 ms
79,060 KB
testcase_31 AC 136 ms
79,236 KB
testcase_32 AC 139 ms
79,056 KB
testcase_33 AC 139 ms
80,052 KB
testcase_34 AC 151 ms
80,588 KB
testcase_35 AC 144 ms
80,008 KB
testcase_36 AC 135 ms
80,600 KB
testcase_37 AC 138 ms
80,504 KB
testcase_38 AC 106 ms
79,464 KB
testcase_39 AC 134 ms
79,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""


"""

import sys
from sys import stdin

alp = "abcdefghijklmnopqrstuvwxyz"

def bitadd(a,w,bit): #aにwを加える(1-origin)

    a += 1
    x = a
    while x <= (len(bit)-1):
        bit[x] += w
        x += x & (-1 * x)
 
def bitsum(a,bit): #ind 1~aまでの和を求める

    a += 1
    ret = 0
    x = a
    while x > 0:
        ret += bit[x]
        x -= x & (-1 * x)
    return ret

ans = []
N,Q = map(int,stdin.readline().split())

S = stdin.readline()[:-1]

b = [[0] * (N+5) for i in range(26)]

for i in range(1,N+1):

    c = ord(S[i-1])-ord('a')
    bitadd(i,1,b[c])

for loop in range(Q):

    L,R,X = map(int,stdin.readline().split())

    for i in range(26):

        X -= bitsum(R,b[i]) - bitsum(L-1,b[i])
        if X <= 0:
            ans.append(alp[i])
            break

print ("\n".join(ans))
0