結果

問題 No.1471 Sort Queries
ユーザー 萩3萩3
提出日時 2021-05-02 20:46:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 82,152 KB
最終ジャッジ日時 2023-09-28 11:29:46
合計ジャッジ時間 6,539 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,604 KB
testcase_01 AC 86 ms
71,544 KB
testcase_02 AC 81 ms
71,636 KB
testcase_03 AC 87 ms
76,756 KB
testcase_04 AC 89 ms
76,704 KB
testcase_05 AC 86 ms
76,552 KB
testcase_06 AC 83 ms
71,788 KB
testcase_07 AC 84 ms
76,424 KB
testcase_08 AC 93 ms
77,216 KB
testcase_09 AC 88 ms
76,464 KB
testcase_10 AC 83 ms
71,300 KB
testcase_11 AC 93 ms
76,632 KB
testcase_12 AC 92 ms
76,692 KB
testcase_13 AC 111 ms
78,192 KB
testcase_14 AC 111 ms
78,224 KB
testcase_15 AC 122 ms
80,008 KB
testcase_16 AC 110 ms
78,228 KB
testcase_17 AC 113 ms
78,796 KB
testcase_18 AC 110 ms
78,060 KB
testcase_19 AC 106 ms
78,068 KB
testcase_20 AC 111 ms
79,476 KB
testcase_21 AC 105 ms
78,168 KB
testcase_22 AC 105 ms
78,340 KB
testcase_23 AC 117 ms
80,496 KB
testcase_24 AC 121 ms
80,896 KB
testcase_25 AC 123 ms
80,916 KB
testcase_26 AC 122 ms
79,912 KB
testcase_27 AC 125 ms
81,368 KB
testcase_28 AC 120 ms
81,332 KB
testcase_29 AC 120 ms
80,328 KB
testcase_30 AC 120 ms
80,616 KB
testcase_31 AC 126 ms
80,668 KB
testcase_32 AC 124 ms
80,288 KB
testcase_33 AC 127 ms
81,968 KB
testcase_34 AC 131 ms
82,152 KB
testcase_35 AC 126 ms
81,584 KB
testcase_36 AC 127 ms
81,892 KB
testcase_37 AC 127 ms
81,848 KB
testcase_38 AC 129 ms
80,940 KB
testcase_39 AC 120 ms
81,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import collections
def resolve():
    readline = sys.stdin.readline
    n,q = map(int,readline().split())
    s = readline().strip()
    orda = ord('a')
    tmp = [0]*26
    sumchr = [None]*(len(s)+1)
    sumchr[0] = [0]* 26

    for i, c in enumerate(s,1):
        tmp[ord(c)-orda] += 1
        sumchr[i] = [cnt for cnt in tmp]

    deq = collections.deque()
    for _ in range(q):
        l,r,x = map(int,readline().split())
        chrcnt = [ri-li for li,ri in zip(sumchr[l-1],sumchr[r])]

        cnt = 0
        for i,cnti in enumerate(chrcnt,orda):
            cnt += cnti
            if x <= cnt:
                deq.append(chr(i))
                break
    print(*deq,sep='\n')
resolve()
0