結果
| 問題 |
No.1471 Sort Queries
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-28 09:33:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 927 bytes |
| コンパイル時間 | 799 ms |
| コンパイル使用メモリ | 90,428 KB |
| 最終ジャッジ日時 | 2025-01-21 01:38:23 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:19: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 26> >, std::array<int, 26> >::value_type’ {aka ‘std::array<int, 26>’} and ‘int’)
27 | S[i+1][j] += S[i][j];
| ^
main.cpp:27:30: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 26> >, std::array<int, 26> >::value_type’ {aka ‘std::array<int, 26>’} and ‘int’)
27 | S[i+1][j] += S[i][j];
| ^
main.cpp:29:15: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 26> >, std::array<int, 26> >::value_type’ {aka ‘std::array<int, 26>’} and ‘int’)
29 | S[i+1][s[i]-'a']++;
| ^
main.cpp:36:22: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 26> >, std::array<int, 26> >::value_type’ {aka ‘std::array<int, 26>’} and ‘int’)
36 | x -= S[r][i]-S[l][i];
| ^
main.cpp:36:30: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 26> >, std::array<int, 26> >::value_type’ {aka ‘std::array<int, 26>’} and ‘int’)
36 | x -= S[r][i]-S[l][i];
| ^
In file included from /usr/include/c++/13/vector:66,
from /usr/include/c++/13/queue:63,
from main.cpp:5:
/usr/include/c++/13/bits/stl_vector.h: In instantiation of ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::array<int, 26>; _Alloc = std::allocator<std::array<int, 26> >; reference = std::array<int, 26>&; size_type = long unsigned int]’:
main.cpp:27:18: required from here
/usr/incl
ソースコード
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
int n, q;
cin >> n >> q;
string s;
cin >> s;
vector<array<int, 26>> S(n+1);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 26; ++j) {
S[i+1][j] += S[i][j];
}
S[i+1][s[i]-'a']++;
}
while(q--){
int l, r, x;
scanf("%d %d %d", &l, &r, &x);
l--;
for (int i = 0; i < 26; ++i) {
x -= S[r][i]-S[l][i];
if(x <= 0){
printf("%c\n", i+'a');
break;
}
}
}
return 0;
}