結果

問題 No.1471 Sort Queries
コンテスト
ユーザー 8nd5t
提出日時 2021-04-09 21:40:28
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 870 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 354 ms
コンパイル使用メモリ 85,216 KB
実行使用メモリ 85,024 KB
最終ジャッジ日時 2026-03-11 09:37:40
合計ジャッジ時間 3,287 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys,math,itertools
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right 
from heapq import heappop,heappush,heapify
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split()))
def inps(): return sys.stdin.readline()
def inpsl(x): tmp = inps(); return list(tmp[:x])
def err(x): print(x); exit()

n,q = inpl()
s = input()
ac = [[0]*26 for _ in range(n+1)]
for i,x in enumerate(s):
    for j in range(26):
        tmp = 1 if 97+j == ord(x) else 0
        ac[i+1][j] = ac[i][j] + tmp

for _ in range(q):
    l,r,X = inpl()
    cnt = 0
    for j in range(26):
        cnt += ac[r][j] - ac[l-1][j]
        if cnt >= X:
            print(chr(97+j))
            break

0