結果
| 問題 |
No.1471 Sort Queries
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-26 23:11:01 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 221 ms / 2,000 ms |
| コード長 | 548 bytes |
| コンパイル時間 | 105 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 14,336 KB |
| 最終ジャッジ日時 | 2024-12-23 19:07:16 |
| 合計ジャッジ時間 | 5,838 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
n, q = map(int, input().split())
S = input()
DP = [[0 for _ in range(26)] for _ in range(n + 1)]
for i in range(n):
idx = ord(S[i]) - ord('a')
for j in range(26):
if j == idx:
DP[i + 1][j] = DP[i][j] + 1
else:
DP[i + 1][j] = DP[i][j]
for _ in range(q):
l, r, x = map(int, input().split())
l -= 1
cnt = 0
for i in range(26):
temp = DP[r][i] - DP[l][i]
if cnt + temp >= x:
print(chr(ord('a') + i))
break
cnt += temp