結果

問題 No.1471 Sort Queries
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-04-09 21:34:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 269 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 13,020 KB
最終ジャッジ日時 2023-09-07 10:11:43
合計ジャッジ時間 6,546 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,920 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 16 ms
7,832 KB
testcase_03 AC 18 ms
7,796 KB
testcase_04 AC 18 ms
7,824 KB
testcase_05 AC 17 ms
7,780 KB
testcase_06 AC 21 ms
7,824 KB
testcase_07 AC 17 ms
7,820 KB
testcase_08 AC 17 ms
7,796 KB
testcase_09 AC 17 ms
7,840 KB
testcase_10 AC 17 ms
7,836 KB
testcase_11 AC 18 ms
7,832 KB
testcase_12 AC 18 ms
7,784 KB
testcase_13 AC 81 ms
9,208 KB
testcase_14 AC 76 ms
8,980 KB
testcase_15 AC 102 ms
9,016 KB
testcase_16 AC 59 ms
8,352 KB
testcase_17 AC 69 ms
8,952 KB
testcase_18 AC 60 ms
8,912 KB
testcase_19 AC 62 ms
8,456 KB
testcase_20 AC 107 ms
9,084 KB
testcase_21 AC 71 ms
8,912 KB
testcase_22 AC 65 ms
9,004 KB
testcase_23 AC 155 ms
10,712 KB
testcase_24 AC 157 ms
10,792 KB
testcase_25 AC 207 ms
11,064 KB
testcase_26 AC 141 ms
9,432 KB
testcase_27 AC 196 ms
12,752 KB
testcase_28 AC 193 ms
12,692 KB
testcase_29 AC 138 ms
9,400 KB
testcase_30 AC 150 ms
10,440 KB
testcase_31 AC 196 ms
10,048 KB
testcase_32 AC 182 ms
9,248 KB
testcase_33 AC 232 ms
13,020 KB
testcase_34 AC 269 ms
12,920 KB
testcase_35 AC 269 ms
12,904 KB
testcase_36 AC 218 ms
12,880 KB
testcase_37 AC 223 ms
12,860 KB
testcase_38 AC 187 ms
10,524 KB
testcase_39 AC 226 ms
12,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())
s = input()
lis = [[0] * (n + 1) for i in range(26)]
for i in range(n):
    num = ord(s[i]) - ord("a")
    lis[num][i + 1] += 1
for i in range(26):
    for j in range(1, n + 1):
        lis[i][j] += lis[i][j - 1]
for _ in range(q):
    l, r, x = map(int, input().split())
    cnt = [lis[i][r] - lis[i][l - 1] for i in range(26)]
    for i in range(26):
        if x - cnt[i] <= 0:
            print(chr(ord("a") + i))
            break
        x -= cnt[i]
0