結果
| 問題 |
No.1471 Sort Queries
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-12 08:49:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 2,000 ms |
| コード長 | 440 bytes |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 81,740 KB |
| 実行使用メモリ | 79,536 KB |
| 最終ジャッジ日時 | 2024-09-16 16:42:21 |
| 合計ジャッジ時間 | 5,002 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
from bisect import bisect_left
N,Q=map(int,input().split())
S=input()
nums=[[0]*26]
for s in S:
res=[nums[-1][i] for i in range(26)]
res[ord(s)-ord("a")]+=1
nums.append(res)
for _ in range(Q):
l,r,x=map(int,input().split())
substring=[0]*26
for i in range(26):
substring[i]=nums[r][i]-nums[l-1][i]
for i in range(25):
substring[i+1]+=substring[i]
print(chr(bisect_left(substring,x)+ord("a")))