結果

問題 No.1471 Sort Queries
ユーザー MineMine
提出日時 2021-09-10 23:10:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 80,840 KB
最終ジャッジ日時 2023-09-02 21:17:48
合計ジャッジ時間 7,988 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,240 KB
testcase_01 AC 76 ms
71,196 KB
testcase_02 AC 78 ms
71,344 KB
testcase_03 AC 85 ms
75,976 KB
testcase_04 AC 80 ms
71,180 KB
testcase_05 AC 78 ms
71,388 KB
testcase_06 AC 77 ms
71,200 KB
testcase_07 AC 78 ms
71,440 KB
testcase_08 AC 87 ms
76,292 KB
testcase_09 AC 83 ms
76,036 KB
testcase_10 AC 77 ms
71,252 KB
testcase_11 AC 79 ms
71,200 KB
testcase_12 AC 83 ms
76,076 KB
testcase_13 AC 109 ms
76,864 KB
testcase_14 AC 107 ms
76,880 KB
testcase_15 AC 121 ms
78,736 KB
testcase_16 AC 110 ms
77,348 KB
testcase_17 AC 105 ms
76,824 KB
testcase_18 AC 104 ms
76,772 KB
testcase_19 AC 109 ms
76,764 KB
testcase_20 AC 118 ms
78,520 KB
testcase_21 AC 110 ms
77,524 KB
testcase_22 AC 107 ms
76,740 KB
testcase_23 AC 135 ms
79,752 KB
testcase_24 AC 133 ms
80,100 KB
testcase_25 AC 140 ms
80,008 KB
testcase_26 AC 135 ms
79,352 KB
testcase_27 AC 139 ms
80,424 KB
testcase_28 AC 139 ms
80,340 KB
testcase_29 AC 133 ms
79,036 KB
testcase_30 AC 125 ms
79,444 KB
testcase_31 AC 143 ms
80,016 KB
testcase_32 AC 144 ms
79,068 KB
testcase_33 AC 148 ms
80,328 KB
testcase_34 AC 151 ms
80,584 KB
testcase_35 AC 149 ms
80,344 KB
testcase_36 AC 142 ms
80,472 KB
testcase_37 AC 144 ms
80,408 KB
testcase_38 AC 150 ms
80,840 KB
testcase_39 AC 132 ms
80,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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