結果

問題 No.875 Range Mindex Query
ユーザー mencottonmencotton
提出日時 2019-09-07 13:58:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 653 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 69,532 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-08 16:46:58
合計ジャッジ時間 11,565 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++)cin >> a[i];

    for (int i = 0; i < q; i++) {
        int ope, l, r;
        cin >> ope >> l >> r;
        l--;
        r--;
        if (ope == 1) {
            swap(a[l], a[r]);
        } else {
            int mi = 1145141919;
            int ret = -1;
            for (int i = l; i <= r; i++) {
                if (mi > a[i]) {
                    mi = a[i];
                    ret = i;
                }
            }
            cout << ret + 1 << endl;
        }
    }
    return 0;
}
0