結果

問題 No.1471 Sort Queries
ユーザー c-yanc-yan
提出日時 2021-04-09 22:33:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 11,660 KB
最終ジャッジ日時 2023-09-07 12:04:39
合計ジャッジ時間 4,507 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,784 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 16 ms
7,864 KB
testcase_03 AC 17 ms
7,808 KB
testcase_04 AC 17 ms
7,796 KB
testcase_05 AC 16 ms
7,948 KB
testcase_06 AC 16 ms
7,960 KB
testcase_07 AC 16 ms
7,968 KB
testcase_08 AC 16 ms
7,816 KB
testcase_09 AC 17 ms
7,864 KB
testcase_10 AC 16 ms
7,824 KB
testcase_11 AC 17 ms
7,792 KB
testcase_12 AC 17 ms
7,944 KB
testcase_13 AC 43 ms
9,680 KB
testcase_14 AC 43 ms
9,520 KB
testcase_15 AC 62 ms
9,592 KB
testcase_16 AC 43 ms
8,568 KB
testcase_17 AC 38 ms
9,516 KB
testcase_18 AC 32 ms
9,412 KB
testcase_19 AC 43 ms
8,648 KB
testcase_20 AC 61 ms
9,568 KB
testcase_21 AC 42 ms
9,112 KB
testcase_22 AC 38 ms
9,152 KB
testcase_23 AC 74 ms
10,716 KB
testcase_24 AC 71 ms
10,744 KB
testcase_25 AC 103 ms
10,848 KB
testcase_26 AC 77 ms
9,984 KB
testcase_27 AC 85 ms
11,092 KB
testcase_28 AC 85 ms
11,236 KB
testcase_29 AC 78 ms
9,980 KB
testcase_30 AC 73 ms
10,608 KB
testcase_31 AC 109 ms
10,460 KB
testcase_32 AC 108 ms
9,988 KB
testcase_33 AC 124 ms
11,436 KB
testcase_34 AC 124 ms
11,340 KB
testcase_35 AC 125 ms
11,416 KB
testcase_36 AC 75 ms
11,392 KB
testcase_37 AC 75 ms
11,504 KB
testcase_38 AC 94 ms
11,564 KB
testcase_39 AC 123 ms
11,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

readline = stdin.readline

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

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

result = []
for _ in range(Q):
    L, R, X = map(int, readline().split())
    t = b[R - 1][:]
    if L != 1:
        u = b[L - 2]
        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 + ord('a')))
        break
print(*result, sep='\n')
0