結果

問題 No.1471 Sort Queries
ユーザー lloyzlloyz
提出日時 2022-01-26 23:11:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 11,712 KB
最終ジャッジ日時 2023-08-25 12:03:29
合計ジャッジ時間 6,931 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,804 KB
testcase_01 AC 16 ms
7,944 KB
testcase_02 AC 15 ms
7,856 KB
testcase_03 AC 17 ms
7,852 KB
testcase_04 AC 17 ms
7,840 KB
testcase_05 AC 17 ms
7,788 KB
testcase_06 AC 16 ms
7,744 KB
testcase_07 AC 16 ms
7,844 KB
testcase_08 AC 18 ms
7,848 KB
testcase_09 AC 17 ms
7,824 KB
testcase_10 AC 16 ms
7,824 KB
testcase_11 AC 17 ms
7,952 KB
testcase_12 AC 18 ms
7,852 KB
testcase_13 AC 85 ms
9,636 KB
testcase_14 AC 81 ms
9,428 KB
testcase_15 AC 104 ms
9,524 KB
testcase_16 AC 57 ms
8,556 KB
testcase_17 AC 76 ms
9,704 KB
testcase_18 AC 64 ms
9,336 KB
testcase_19 AC 60 ms
8,540 KB
testcase_20 AC 104 ms
9,656 KB
testcase_21 AC 77 ms
9,496 KB
testcase_22 AC 69 ms
9,464 KB
testcase_23 AC 149 ms
10,728 KB
testcase_24 AC 149 ms
10,876 KB
testcase_25 AC 188 ms
10,956 KB
testcase_26 AC 139 ms
9,988 KB
testcase_27 AC 177 ms
11,404 KB
testcase_28 AC 177 ms
11,156 KB
testcase_29 AC 137 ms
10,084 KB
testcase_30 AC 147 ms
10,764 KB
testcase_31 AC 182 ms
10,536 KB
testcase_32 AC 177 ms
9,924 KB
testcase_33 AC 230 ms
11,384 KB
testcase_34 AC 224 ms
11,500 KB
testcase_35 AC 227 ms
11,480 KB
testcase_36 AC 220 ms
11,496 KB
testcase_37 AC 222 ms
11,500 KB
testcase_38 AC 173 ms
11,712 KB
testcase_39 AC 227 ms
11,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())
S = input()
DP = [[0 for _ in range(26)] for _ in range(n + 1)]
for i in range(n):
    idx = ord(S[i]) - ord('a')
    for j in range(26):
        if j == idx:
            DP[i + 1][j] = DP[i][j] + 1
        else:
            DP[i + 1][j] = DP[i][j]

for _ in range(q):
    l, r, x = map(int, input().split())
    l -= 1
    cnt = 0
    for i in range(26):
        temp = DP[r][i] - DP[l][i]
        if cnt + temp >= x:
            print(chr(ord('a') + i))
            break
        cnt += temp
0