結果

問題 No.1471 Sort Queries
ユーザー rlangevinrlangevin
提出日時 2023-01-01 01:54:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 731 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 82,328 KB
最終ジャッジ日時 2023-08-17 22:59:07
合計ジャッジ時間 6,892 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,416 KB
testcase_01 AC 78 ms
71,464 KB
testcase_02 AC 79 ms
71,484 KB
testcase_03 AC 84 ms
76,236 KB
testcase_04 AC 80 ms
71,192 KB
testcase_05 AC 79 ms
71,460 KB
testcase_06 AC 78 ms
71,412 KB
testcase_07 AC 77 ms
71,408 KB
testcase_08 AC 84 ms
76,600 KB
testcase_09 AC 81 ms
76,192 KB
testcase_10 AC 79 ms
71,400 KB
testcase_11 AC 80 ms
71,508 KB
testcase_12 AC 84 ms
76,324 KB
testcase_13 AC 101 ms
77,092 KB
testcase_14 AC 100 ms
76,984 KB
testcase_15 AC 102 ms
77,172 KB
testcase_16 AC 98 ms
76,908 KB
testcase_17 AC 100 ms
77,076 KB
testcase_18 AC 101 ms
76,984 KB
testcase_19 AC 99 ms
76,844 KB
testcase_20 AC 103 ms
77,020 KB
testcase_21 AC 101 ms
77,108 KB
testcase_22 AC 99 ms
77,128 KB
testcase_23 AC 116 ms
80,988 KB
testcase_24 AC 113 ms
80,900 KB
testcase_25 AC 118 ms
81,092 KB
testcase_26 AC 114 ms
80,472 KB
testcase_27 AC 124 ms
82,220 KB
testcase_28 AC 122 ms
81,932 KB
testcase_29 AC 116 ms
80,560 KB
testcase_30 AC 113 ms
80,872 KB
testcase_31 AC 120 ms
80,708 KB
testcase_32 AC 117 ms
80,340 KB
testcase_33 AC 121 ms
81,816 KB
testcase_34 AC 123 ms
81,880 KB
testcase_35 AC 124 ms
81,900 KB
testcase_36 AC 118 ms
81,844 KB
testcase_37 AC 120 ms
81,908 KB
testcase_38 AC 120 ms
82,328 KB
testcase_39 AC 112 ms
81,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline

def alp_to_num(cha):
    num = ord(cha) - ord("a")
    return num

N, Q = map(int, readline().split())
S = list(input())
S = list(map(alp_to_num, S))
D = [[0] * N for i in range(26)]
Ac = [[0] * (N + 1) for i in range(26)]
for i in range(N):
    D[S[i]][i] = 1
    
for i in range(N):
    for k in range(26):
        Ac[k][i + 1] = Ac[k][i] + D[k][i]
        
for _ in range(Q):
    L, R, X = map(int, readline().split())
    L = L - 1
    cnt = 0
    for k in range(26):
        cnt += Ac[k][R] - Ac[k][L]
        if cnt >= X:
            print(chr(k + ord("a")))
            break
0