結果
問題 | No.1471 Sort Queries |
ユーザー | firiexp |
提出日時 | 2021-04-28 09:33:25 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 927 bytes |
コンパイル時間 | 807 ms |
コンパイル使用メモリ | 92,448 KB |
最終ジャッジ日時 | 2023-09-21 10:21:30 |
合計ジャッジ時間 | 2,514 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:27:19: エラー: 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: エラー: 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: エラー: 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: エラー: 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: エラー: 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]; | ^ 次のファイルから読み込み: /usr/local/gcc7/include/c++/12.2.0/vector:64, 次から読み込み: /usr/local/gcc7/include/c++/12.2.0/queue:61, 次から読み込み: main.cpp:5: /usr/local/gcc7/include/c++/12.2.0/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 =
ソースコード
#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; }