結果

問題 No.1471 Sort Queries
ユーザー 👑 tamatotamato
提出日時 2021-04-09 21:31:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 685 bytes
コンパイル時間 1,785 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 80,196 KB
最終ジャッジ日時 2023-09-07 10:00:49
合計ジャッジ時間 6,387 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,556 KB
testcase_01 AC 72 ms
71,520 KB
testcase_02 AC 73 ms
71,552 KB
testcase_03 AC 77 ms
76,308 KB
testcase_04 AC 77 ms
71,800 KB
testcase_05 AC 75 ms
71,420 KB
testcase_06 AC 73 ms
71,560 KB
testcase_07 AC 73 ms
71,760 KB
testcase_08 AC 80 ms
76,508 KB
testcase_09 AC 78 ms
76,308 KB
testcase_10 AC 73 ms
71,848 KB
testcase_11 AC 76 ms
71,752 KB
testcase_12 AC 81 ms
76,204 KB
testcase_13 AC 95 ms
77,256 KB
testcase_14 AC 92 ms
77,028 KB
testcase_15 AC 97 ms
77,200 KB
testcase_16 AC 96 ms
77,076 KB
testcase_17 AC 93 ms
76,840 KB
testcase_18 AC 93 ms
77,256 KB
testcase_19 AC 92 ms
77,144 KB
testcase_20 AC 93 ms
77,404 KB
testcase_21 AC 94 ms
77,360 KB
testcase_22 AC 92 ms
77,360 KB
testcase_23 AC 106 ms
79,504 KB
testcase_24 AC 106 ms
79,492 KB
testcase_25 AC 111 ms
79,636 KB
testcase_26 AC 106 ms
78,996 KB
testcase_27 AC 108 ms
79,856 KB
testcase_28 AC 109 ms
80,036 KB
testcase_29 AC 105 ms
79,164 KB
testcase_30 AC 101 ms
79,508 KB
testcase_31 AC 109 ms
79,444 KB
testcase_32 AC 107 ms
79,012 KB
testcase_33 AC 108 ms
79,884 KB
testcase_34 AC 114 ms
79,624 KB
testcase_35 AC 109 ms
79,828 KB
testcase_36 AC 106 ms
79,944 KB
testcase_37 AC 106 ms
79,580 KB
testcase_38 AC 104 ms
80,196 KB
testcase_39 AC 100 ms
79,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N, Q = map(int, input().split())
    S = input().rstrip('\n')
    A = [ord(s) - 97 for s in S]
    cs = [[0] * (N+1) for _ in range(26)]
    for i, a in enumerate(A):
        for j in range(26):
            if a == j:
                cs[j][i+1] = cs[j][i] + 1
            else:
                cs[j][i+1] = cs[j][i]
    for _ in range(Q):
        l, r, x = map(int, input().split())
        cnt = 0
        for j in range(26):
            cnt += cs[j][r] - cs[j][l-1]
            if cnt >= x:
                print(chr(j + 97))
                break


if __name__ == '__main__':
    main()
0