結果

問題 No.397 NO MORE KADOMATSU
ユーザー kurenai3110kurenai3110
提出日時 2016-07-15 23:12:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 1,263 ms
コンパイル使用メモリ 64,684 KB
実行使用メモリ 24,360 KB
平均クエリ数 935.83
最終ジャッジ日時 2023-09-23 11:04:26
合計ジャッジ時間 4,362 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n;
void  bubblesort(vector<int> &a) {
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				cout << j << " " << j - 1 << endl;
				swap(a[j], a[j - 1]);
				flag = 1;
			}
		}
	}
}

int main() {
	vector<int> a;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	bubblesort(a);

	return 0;
}
0