結果

問題 No.1471 Sort Queries
ユーザー momoyuumomoyuu
提出日時 2022-08-03 17:18:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 1,026 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 88,132 KB
最終ジャッジ日時 2023-10-11 11:48:41
合計ジャッジ時間 9,927 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,196 KB
testcase_01 AC 74 ms
71,184 KB
testcase_02 AC 76 ms
71,388 KB
testcase_03 AC 103 ms
76,680 KB
testcase_04 AC 84 ms
76,568 KB
testcase_05 AC 79 ms
76,452 KB
testcase_06 AC 74 ms
71,420 KB
testcase_07 AC 87 ms
76,868 KB
testcase_08 AC 87 ms
76,752 KB
testcase_09 AC 82 ms
76,640 KB
testcase_10 AC 77 ms
71,500 KB
testcase_11 AC 81 ms
76,296 KB
testcase_12 AC 89 ms
76,724 KB
testcase_13 AC 145 ms
78,368 KB
testcase_14 AC 140 ms
78,496 KB
testcase_15 AC 158 ms
82,296 KB
testcase_16 AC 134 ms
78,580 KB
testcase_17 AC 140 ms
78,800 KB
testcase_18 AC 135 ms
78,488 KB
testcase_19 AC 134 ms
78,612 KB
testcase_20 AC 154 ms
82,420 KB
testcase_21 AC 139 ms
78,620 KB
testcase_22 AC 143 ms
78,612 KB
testcase_23 AC 175 ms
85,868 KB
testcase_24 AC 174 ms
85,512 KB
testcase_25 AC 185 ms
85,944 KB
testcase_26 AC 170 ms
83,384 KB
testcase_27 AC 181 ms
86,940 KB
testcase_28 AC 179 ms
86,644 KB
testcase_29 AC 166 ms
83,624 KB
testcase_30 AC 170 ms
85,404 KB
testcase_31 AC 180 ms
85,336 KB
testcase_32 AC 182 ms
83,572 KB
testcase_33 AC 193 ms
88,132 KB
testcase_34 AC 200 ms
87,652 KB
testcase_35 AC 200 ms
87,572 KB
testcase_36 AC 186 ms
87,704 KB
testcase_37 AC 185 ms
88,092 KB
testcase_38 AC 182 ms
84,716 KB
testcase_39 AC 189 ms
87,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int,input().split())
S = input()
lrx = [list(map(int,input().split( ))) for _ in range(Q)]

cs = {
    "a":1,"b":2,"c":3,"d":4,"e":5,
    "f":6,"g":7,"h":8,"i":9,"j":10,
    "k":11,"l":12,"m":13,"n":14,"o":15,
    "p":16,"q":17,"r":18,"s":19,"t":20,
    "u":21,"v":22,"w":23,"x":24,"y":25,
    "z":26}
for i in cs:
    cs[i] = 0
al = "abcdefghijklmnopqrstuvwxyz"
sum = [{} for _ in range(N+1)]
for i in range(N+1):
    for j in cs:
        sum[i][j] = 0
    if i == 0:
        continue
    for j in cs:
        sum[i][j] = sum[i-1][j]
    sum[i][S[i-1]] += 1

for i in range(Q):
    l,r,x = lrx[i]
    for j in cs:
        cs[j] = sum[r][j] - sum[l-1][j]
    now = 0
    for j in range(len(al)):
        now += cs[al[j]]
        if now >= x:
            print(al[j])
            break

0