結果
| 問題 |
No.1471 Sort Queries
|
| コンテスト | |
| ユーザー |
cookiedoth
|
| 提出日時 | 2021-04-09 21:37:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 2,098 bytes |
| コンパイル時間 | 1,464 ms |
| コンパイル使用メモリ | 129,368 KB |
| 最終ジャッジ日時 | 2025-01-20 13:49:46 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
/*
Code for problem C by cookiedoth
Generated 09 Apr 2021 at 03.34 PM
█▒▒▒▒▒▒▒▒▒
10%
███▒▒▒▒▒▒▒
30%
█████▒▒▒▒▒
50%
███████▒▒▒
70%
██████████
100%
¯\_(ツ)_/¯
^_^
-_-
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
#include <random>
#include <utility>
#include <tuple>
#include <chrono>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define debug(a) cerr << #a << " = " << a << endl
#define forn(i, n) for (int i = 0; i < n; ++i)
#define length(a) (int)a.size()
using namespace std;
template<class T> int chkmax(T &a, T b) {
if (b > a) {
a = b;
return 1;
}
return 0;
}
template<class T> int chkmin(T &a, T b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template<class iterator> void output(iterator begin, iterator end, ostream& out = cerr) {
while (begin != end) {
out << (*begin) << " ";
begin++;
}
out << endl;
}
template<class T> void output(T x, ostream& out = cerr) {
output(x.begin(), x.end(), out);
}
void fast_io() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
const int K = 26;
const int mx = 1e4 + 228;
int n, q;
string s;
int pref[mx][K];
signed main() {
fast_io();
cin >> n >> q;
cin >> s;
for (int i = 0; i < n; ++i) {
copy(pref[i], pref[i] + K, pref[i + 1]);
pref[i + 1][s[i] - 'a']++;
}
for (int i = 0; i < q; ++i) {
int l, r, x;
cin >> l >> r >> x;
l--;
r--;
x--;
for (int j = 0; j < K; ++j) {
if (x < pref[r + 1][j] - pref[l][j]) {
cout << (char)('a' + j) << '\n';
break;
} else {
x -= pref[r + 1][j] - pref[l][j];
}
}
}
}
cookiedoth