結果

問題 No.1471 Sort Queries
ユーザー Saleh Isayev
提出日時 2021-04-09 21:38:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 833 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 173,748 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-25 04:35:01
合計ジャッジ時間 3,996 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define int ll
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb emplace_back
#define pii pair<int , int>
#define F first
#define S second
const int mod = 1000000007;
const int MAXX = 1e6 + 5;

int n , q , l , r , x;
string s;

signed main()
{
    _FastIO;
    cin >> n >> q;
    cin >> s;
    vector<pair<char , int> > v;
    for(int i = 0; i < n; i++){
        v.push_back({s[i] , i + 1});
    }
    sort(v.begin() , v.end());
    while(q--){
        cin >> l >> r >> x;
        for(int i = 0; i < n; i++){
            if(v[i].S >= l && v[i].S <= r){
                x--;
                if(!x){
                   cout << v[i].F << endl;
                    break;
                }

            }
        }
    }
    return 0;
}
0