結果

問題 No.1471 Sort Queries
ユーザー c-yanc-yan
提出日時 2021-04-10 20:38:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 11,684 KB
最終ジャッジ日時 2023-09-08 16:22:00
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,852 KB
testcase_01 AC 15 ms
7,948 KB
testcase_02 AC 16 ms
7,768 KB
testcase_03 AC 16 ms
7,892 KB
testcase_04 AC 16 ms
7,852 KB
testcase_05 AC 16 ms
7,804 KB
testcase_06 AC 16 ms
7,788 KB
testcase_07 AC 15 ms
7,768 KB
testcase_08 AC 17 ms
7,760 KB
testcase_09 AC 16 ms
7,888 KB
testcase_10 AC 16 ms
7,748 KB
testcase_11 AC 16 ms
7,800 KB
testcase_12 AC 16 ms
7,788 KB
testcase_13 AC 43 ms
9,652 KB
testcase_14 AC 41 ms
9,480 KB
testcase_15 AC 60 ms
9,572 KB
testcase_16 AC 43 ms
8,456 KB
testcase_17 AC 37 ms
9,560 KB
testcase_18 AC 32 ms
9,236 KB
testcase_19 AC 41 ms
8,452 KB
testcase_20 AC 59 ms
9,608 KB
testcase_21 AC 39 ms
9,120 KB
testcase_22 AC 36 ms
9,132 KB
testcase_23 AC 74 ms
10,564 KB
testcase_24 AC 73 ms
10,556 KB
testcase_25 AC 99 ms
10,848 KB
testcase_26 AC 81 ms
10,108 KB
testcase_27 AC 83 ms
11,324 KB
testcase_28 AC 83 ms
11,068 KB
testcase_29 AC 75 ms
10,060 KB
testcase_30 AC 75 ms
10,488 KB
testcase_31 AC 109 ms
10,452 KB
testcase_32 AC 111 ms
10,068 KB
testcase_33 AC 119 ms
11,388 KB
testcase_34 AC 119 ms
11,532 KB
testcase_35 AC 117 ms
11,384 KB
testcase_36 AC 78 ms
11,388 KB
testcase_37 AC 75 ms
11,304 KB
testcase_38 AC 95 ms
11,684 KB
testcase_39 AC 116 ms
11,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

readline = stdin.readline

N, Q = map(int, readline().split())
S = readline()[:-1].encode('us-ascii')

a = [0] * 26
b = []
for c in S:
    i = c - 97
    a[i] += 1
    b.append(a[:])

result = []
for _ in range(Q):
    L, R, X = map(int, readline().split())
    L, R = L - 1, R - 1
    t = b[R][:]
    if L != 0:
        u = b[L - 1]
        for i in range(26):
            t[i] -= u[i]
    c = 0
    for i in range(26):
        c += t[i]
        if c < X:
            continue
        result.append(chr(i + 97))
        break
print(*result, sep='\n')
0