結果

問題 No.875 Range Mindex Query
ユーザー Konton7Konton7
提出日時 2020-02-04 05:37:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 912 bytes
コンパイル時間 2,042 ms
コンパイル使用メモリ 203,848 KB
実行使用メモリ 8,376 KB
最終ジャッジ日時 2023-10-19 20:46:12
合計ジャッジ時間 6,522 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,352 KB
testcase_01 AC 3 ms
4,348 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, q, p, l, r;
    cin >> n >> q;
    vector<int> rmq;

    rep(i, n)
    {
        cin >> p;
        rmq.push_back(p);
    }
    rep(i, q)
    {
        cin >> p >> l >> r;
        if(p == 1)
            swap(rmq[l-1], rmq[r-1]);
        else
        {
            auto k = min_element(rmq.begin() + l - 1, rmq.begin() + r);
            cout << distance(rmq.begin(), k) + 1 << endl;
        }
        
    }

    // for (auto z : rmq)
    //     cout << z << " ";
    // cout << endl;


    return 0;
}
0