結果

問題 No.1471 Sort Queries
ユーザー Example0911Example0911
提出日時 2021-04-09 21:28:39
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 1,931 ms
コンパイル使用メモリ 204,448 KB
実行使用メモリ 5,228 KB
最終ジャッジ日時 2023-09-07 09:54:19
合計ジャッジ時間 3,584 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 6 ms
4,380 KB
testcase_14 AC 6 ms
4,380 KB
testcase_15 AC 9 ms
4,380 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 9 ms
4,376 KB
testcase_21 AC 5 ms
4,380 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 11 ms
4,696 KB
testcase_24 AC 11 ms
4,816 KB
testcase_25 AC 15 ms
4,876 KB
testcase_26 AC 12 ms
4,380 KB
testcase_27 AC 13 ms
5,220 KB
testcase_28 AC 13 ms
5,132 KB
testcase_29 AC 11 ms
4,552 KB
testcase_30 AC 10 ms
4,616 KB
testcase_31 AC 17 ms
4,624 KB
testcase_32 AC 16 ms
4,380 KB
testcase_33 AC 17 ms
5,228 KB
testcase_34 AC 19 ms
5,156 KB
testcase_35 AC 18 ms
5,168 KB
testcase_36 AC 17 ms
5,140 KB
testcase_37 AC 17 ms
5,172 KB
testcase_38 AC 17 ms
5,152 KB
testcase_39 AC 17 ms
5,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
//#define int long long
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 1000000007;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N, Q; cin >> N >> Q;
	string S; cin >> S;
	vector<vector<ll>>sum(26, vector<ll>(N + 1));
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < N; j++) {
			sum[i][j + 1] = sum[i][j];
			if (S[j] - 'a' == i)sum[i][j + 1]++;
		}
	}
	for (int _ = 0; _ < Q; _++) {
		ll L, R, X; cin >> L >> R >> X; L--;
		ll t = 0;
		for (int i = 0; i < 26; i++) {
			ll now = sum[i][R] - sum[i][L];
			t += now;
			if (t >= X) {
				cout << (char)('a' + i) << endl;
				break;
			}
		}
	}
	return 0;
}
0