結果
| 問題 | No.1471 Sort Queries |
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2021-04-09 22:30:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 691 bytes |
| 記録 | |
| コンパイル時間 | 1,998 ms |
| コンパイル使用メモリ | 196,528 KB |
| 最終ジャッジ日時 | 2025-01-20 14:47:38 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
int main() {
cin.tie(nullptr), ios::sync_with_stdio(false);
int N, Q;
string S;
cin >> N >> Q >> S;
constexpr int D = 26;
vector cnt(D, vector<int>(N + 1));
REP(i, N) {
int d = S[i] - 'a';
REP(e, D) cnt[e][i + 1] = cnt[e][i] + (d == e);
}
while (Q--) {
int l, r, x;
cin >> l >> r >> x;
l--;
REP(a, D) {
auto ox = x;
x -= cnt[a][r] - cnt[a][l];
if (ox > 0 and x <= 0) cout << (char)('a' + a) << '\n';
}
}
}
hitonanode