結果

問題 No.1471 Sort Queries
ユーザー rodearodea
提出日時 2021-04-11 14:10:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 80,652 KB
最終ジャッジ日時 2023-09-09 16:35:53
合計ジャッジ時間 6,791 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,944 KB
testcase_01 AC 74 ms
70,916 KB
testcase_02 AC 73 ms
71,208 KB
testcase_03 AC 84 ms
76,076 KB
testcase_04 AC 76 ms
71,044 KB
testcase_05 AC 75 ms
71,044 KB
testcase_06 AC 72 ms
71,200 KB
testcase_07 AC 74 ms
71,076 KB
testcase_08 AC 85 ms
76,168 KB
testcase_09 AC 80 ms
76,080 KB
testcase_10 AC 75 ms
71,208 KB
testcase_11 AC 76 ms
70,996 KB
testcase_12 AC 83 ms
76,128 KB
testcase_13 AC 122 ms
79,112 KB
testcase_14 AC 119 ms
78,820 KB
testcase_15 AC 124 ms
79,152 KB
testcase_16 AC 117 ms
78,012 KB
testcase_17 AC 116 ms
79,220 KB
testcase_18 AC 114 ms
79,160 KB
testcase_19 AC 114 ms
77,732 KB
testcase_20 AC 123 ms
79,120 KB
testcase_21 AC 119 ms
79,368 KB
testcase_22 AC 115 ms
79,180 KB
testcase_23 AC 139 ms
79,732 KB
testcase_24 AC 141 ms
79,400 KB
testcase_25 AC 150 ms
79,916 KB
testcase_26 AC 140 ms
79,448 KB
testcase_27 AC 143 ms
79,964 KB
testcase_28 AC 144 ms
79,980 KB
testcase_29 AC 141 ms
79,628 KB
testcase_30 AC 134 ms
79,252 KB
testcase_31 AC 151 ms
79,400 KB
testcase_32 AC 149 ms
79,348 KB
testcase_33 AC 156 ms
80,200 KB
testcase_34 AC 159 ms
80,372 KB
testcase_35 AC 156 ms
80,652 KB
testcase_36 AC 151 ms
80,452 KB
testcase_37 AC 155 ms
80,276 KB
testcase_38 AC 154 ms
80,444 KB
testcase_39 AC 138 ms
80,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())
s = input()

alpsum = [[0 for j in range(26)] for i in range(n + 1)]
for i in range(n):
    for j in range(26):
        alpsum[i + 1][j] += alpsum[i][j] + (j == ord(s[i]) - 97)

for i in range(q):
    l, r, x = map(int, input().split())
    l -= 1
    r -= 1
    for j in range(26):
        if alpsum[r + 1][j] - alpsum[l][j] >= x:
            print(chr(j + 97))
            break
        else:
            x -= alpsum[r + 1][j] - alpsum[l][j]
0