結果

問題 No.397 NO MORE KADOMATSU
ユーザー purple_jwlpurple_jwl
提出日時 2016-07-15 22:47:22
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,080 bytes
コンパイル時間 1,615 ms
コンパイル使用メモリ 148,088 KB
実行使用メモリ 36,276 KB
最終ジャッジ日時 2023-09-24 00:14:27
合計ジャッジ時間 7,758 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

const int INF = 1 << 29;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    int tmp;
    cin >> tmp;

    int cnt = 0;
    vector<pair<int, int>> p;
    rep (i, n) {
        int minv = a[i];
        int idx = i;
        REP (j, i + 1, n) {
            if (minv > a[j]) {
                minv = a[j];
                idx = j;
            }
        }
        if (idx != i) {
            cnt++;
            p.eb(mp(i, idx));
        }
    }

    cout << cnt << endl;
    rep (i, sz(p)) {
        cout << p[i].F << ' ' << p[i].S << endl;
    }
}
0