結果
問題 |
No.397 NO MORE KADOMATSU
|
ユーザー |
![]() |
提出日時 | 2025-03-20 00:30:49 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 776 bytes |
コンパイル時間 | 3,526 ms |
コンパイル使用メモリ | 278,732 KB |
実行使用メモリ | 41,224 KB |
最終ジャッジ日時 | 2025-03-20 00:31:00 |
合計ジャッジ時間 | 10,516 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; vector<pair<int, int>> ans; rep(i, n) { int minim = i; for (int j = i; j < n; ++j) { if (a[j] < a[minim]) minim = j; } if (i != minim) { swap(a[i], a[minim]); ans.push_back({ i, minim }); } } assert(is_sorted(a.begin(), a.end())); cout << ans.size() << '\n'; for (auto [x, y] : ans) { cout << x << ' ' << y << '\n'; } int dummy; cin >> dummy; return 0; }