結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー | ctyl_0 |
提出日時 | 2016-07-15 22:40:43 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 1,163 bytes |
コンパイル時間 | 731 ms |
コンパイル使用メモリ | 89,520 KB |
実行使用メモリ | 24,348 KB |
平均クエリ数 | 651.67 |
最終ジャッジ日時 | 2023-09-24 00:13:25 |
合計ジャッジ時間 | 2,514 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
23,664 KB |
testcase_01 | AC | 26 ms
23,652 KB |
testcase_02 | AC | 26 ms
24,036 KB |
testcase_03 | AC | 26 ms
23,568 KB |
testcase_04 | AC | 25 ms
24,348 KB |
testcase_05 | AC | 28 ms
23,640 KB |
testcase_06 | AC | 28 ms
23,580 KB |
testcase_07 | AC | 27 ms
23,568 KB |
testcase_08 | AC | 26 ms
23,928 KB |
testcase_09 | AC | 25 ms
23,652 KB |
testcase_10 | AC | 55 ms
24,036 KB |
testcase_11 | AC | 27 ms
23,388 KB |
testcase_12 | AC | 27 ms
23,448 KB |
testcase_13 | AC | 33 ms
23,424 KB |
testcase_14 | AC | 36 ms
23,796 KB |
testcase_15 | AC | 36 ms
23,700 KB |
testcase_16 | AC | 26 ms
23,676 KB |
testcase_17 | AC | 25 ms
24,036 KB |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <numeric> #include <functional> #include <cmath> #include <queue> #include <stack> #include <set> #include <map> #include <sstream> #include <string> #define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repd(i,0,n) #define all(x) (x).begin(),(x).end() #define mod 1000000007 #define inf 2000000007 #define mp make_pair #define pb push_back typedef long long ll; using namespace std; template <typename T> inline void output(T a, int p) { if(p) cout << fixed << setprecision(p) << a << "\n"; else cout << a << "\n"; } // end of template int main() { cin.tie(0); ios::sync_with_stdio(0); // source code int N; cin >> N; vector<int> A(N); rep(i, N) cin >> A[i]; vector<pair<int, int>> ret; rep(i, N) repd(j, i + 1, N){ if(A[i] > A[j]){ swap(A[i], A[j]); ret.pb(mp(i, j)); } } cout << (int)ret.size() << endl; rep(i, ret.size()) cout << ret[i].first << " " << ret[i].second << endl; cout << flush; int B; cin >> B; return 0; }