結果

問題 No.1471 Sort Queries
ユーザー lie_of_lillielie_of_lillie
提出日時 2021-05-06 11:01:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 12,340 KB
最終ジャッジ日時 2023-10-12 04:13:30
合計ジャッジ時間 5,354 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,672 KB
testcase_01 AC 20 ms
8,508 KB
testcase_02 AC 20 ms
8,544 KB
testcase_03 AC 20 ms
8,632 KB
testcase_04 AC 19 ms
8,556 KB
testcase_05 AC 19 ms
8,672 KB
testcase_06 AC 19 ms
8,628 KB
testcase_07 AC 19 ms
8,500 KB
testcase_08 AC 19 ms
8,500 KB
testcase_09 AC 19 ms
8,624 KB
testcase_10 AC 19 ms
8,492 KB
testcase_11 AC 19 ms
8,588 KB
testcase_12 AC 20 ms
8,608 KB
testcase_13 AC 50 ms
10,092 KB
testcase_14 AC 48 ms
9,824 KB
testcase_15 AC 63 ms
10,164 KB
testcase_16 AC 44 ms
9,112 KB
testcase_17 AC 43 ms
10,028 KB
testcase_18 AC 38 ms
9,880 KB
testcase_19 AC 46 ms
9,132 KB
testcase_20 AC 66 ms
10,148 KB
testcase_21 AC 46 ms
9,964 KB
testcase_22 AC 41 ms
9,972 KB
testcase_23 AC 81 ms
11,176 KB
testcase_24 AC 80 ms
11,280 KB
testcase_25 AC 109 ms
11,664 KB
testcase_26 AC 85 ms
10,496 KB
testcase_27 AC 95 ms
12,032 KB
testcase_28 AC 94 ms
11,928 KB
testcase_29 AC 85 ms
10,508 KB
testcase_30 AC 80 ms
11,228 KB
testcase_31 AC 112 ms
11,032 KB
testcase_32 AC 113 ms
10,700 KB
testcase_33 AC 128 ms
12,132 KB
testcase_34 AC 132 ms
12,216 KB
testcase_35 AC 133 ms
11,984 KB
testcase_36 AC 125 ms
11,992 KB
testcase_37 AC 126 ms
12,144 KB
testcase_38 AC 103 ms
12,340 KB
testcase_39 AC 127 ms
12,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N,Q=map(int,input().split())
S=input()

cumsum = [None for i in range(len(S)+1)]
cumsum[0] = [0]*26
chidx = [0]*26
for i,s in enumerate(S, 1):
    chidx[ord(s) - ord('a')] += 1
    cumsum[i] = [a for a in chidx]
#print(chidx)

deq = collections.deque()
for q in range(Q):
    l,r,x=map(int,input().split())
    #print("debu", l, r, x)
    diff = [ri-li for ri,li in zip(cumsum[r], cumsum[l-1])]

    tmp = 0
    for i, d in enumerate(diff, ord('a')):
        tmp += d
        if tmp >= x:
            deq.append(chr(i))
            break
print(*deq,sep='\n')
0