結果

問題 No.397 NO MORE KADOMATSU
ユーザー olpheolphe
提出日時 2016-11-15 01:09:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 51,860 KB
実行使用メモリ 24,324 KB
平均クエリ数 414.83
最終ジャッジ日時 2023-09-24 00:42:02
合計ジャッジ時間 2,163 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,400 KB
testcase_01 AC 25 ms
24,324 KB
testcase_02 AC 26 ms
23,364 KB
testcase_03 AC 28 ms
23,376 KB
testcase_04 AC 25 ms
23,628 KB
testcase_05 AC 27 ms
24,012 KB
testcase_06 AC 25 ms
23,376 KB
testcase_07 AC 26 ms
23,652 KB
testcase_08 AC 25 ms
23,364 KB
testcase_09 AC 24 ms
23,520 KB
testcase_10 AC 26 ms
23,664 KB
testcase_11 AC 25 ms
24,252 KB
testcase_12 AC 25 ms
23,796 KB
testcase_13 AC 31 ms
23,376 KB
testcase_14 AC 31 ms
23,664 KB
testcase_15 AC 31 ms
23,364 KB
testcase_16 AC 25 ms
23,784 KB
testcase_17 AC 25 ms
24,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
using namespace std;

int N;
int num[100];
int box;
int ans;
int first[10000];
int second[10000];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> num[i];
	}
	for (int i = 0; i < N-1; i++) {
		for (int j = i+1; j < N; j++) {
			if (num[i] < num[j]) {
				box = num[i];
				num[i] = num[j];
				num[j] = box;
				first[ans] = i;
				second[ans] = j;
				ans++;
			}
		}
	}
	cout << ans << "\n";
	for (int i = 0; i < ans; i++) {
		cout << first[i] << " " << second[i] << "\n";
	}
	cout << endl;
	cin >> ans;
	return 0;
}
0