結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー | tetsuzuki1115 |
提出日時 | 2018-03-07 03:42:39 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 860 bytes |
コンパイル時間 | 822 ms |
コンパイル使用メモリ | 87,364 KB |
実行使用メモリ | 24,312 KB |
平均クエリ数 | 936.56 |
最終ジャッジ日時 | 2023-09-24 01:39:52 |
合計ジャッジ時間 | 3,048 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
24,300 KB |
testcase_01 | AC | 25 ms
23,988 KB |
testcase_02 | AC | 25 ms
24,000 KB |
testcase_03 | AC | 27 ms
23,640 KB |
testcase_04 | AC | 27 ms
23,412 KB |
testcase_05 | AC | 26 ms
23,544 KB |
testcase_06 | AC | 29 ms
23,388 KB |
testcase_07 | AC | 29 ms
24,000 KB |
testcase_08 | AC | 27 ms
24,000 KB |
testcase_09 | AC | 26 ms
23,652 KB |
testcase_10 | AC | 54 ms
23,388 KB |
testcase_11 | AC | 25 ms
24,312 KB |
testcase_12 | AC | 33 ms
23,532 KB |
testcase_13 | AC | 38 ms
23,988 KB |
testcase_14 | AC | 38 ms
23,640 KB |
testcase_15 | AC | 38 ms
23,640 KB |
testcase_16 | AC | 25 ms
23,832 KB |
testcase_17 | AC | 25 ms
23,364 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; struct P { P( int x, int y ) { a = x; b = y; }; int a; int b; }; int main() { int N; cin >> N; vector<int> A(N); for ( int i = 0; i < N; i++ ) { cin >> A[i]; } vector<P> V; for ( int i = 0; i < N-1; i++ ) { for ( int j = 0; j < N-1-i; j++ ) { if ( A[j] > A[j+1] ) { swap( A[j], A[j+1] ); P p(j,j+1); V.push_back(p); } } } cout << V.size() << endl; for ( auto& v : V ) { cout << v.a << " " << v.b << endl; } cin >> N; return 0; }