結果

問題 No.397 NO MORE KADOMATSU
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-07-15 23:10:20
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 1,079 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 78,480 KB
実行使用メモリ 24,372 KB
平均クエリ数 936.56
最終ジャッジ日時 2023-09-24 00:16:25
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,964 KB
testcase_01 AC 24 ms
23,664 KB
testcase_02 AC 25 ms
23,736 KB
testcase_03 AC 25 ms
23,400 KB
testcase_04 AC 23 ms
23,400 KB
testcase_05 AC 25 ms
24,036 KB
testcase_06 AC 26 ms
23,580 KB
testcase_07 AC 27 ms
23,376 KB
testcase_08 AC 24 ms
23,352 KB
testcase_09 AC 24 ms
23,664 KB
testcase_10 AC 42 ms
23,424 KB
testcase_11 AC 23 ms
23,508 KB
testcase_12 AC 29 ms
24,372 KB
testcase_13 AC 33 ms
24,036 KB
testcase_14 AC 34 ms
23,520 KB
testcase_15 AC 34 ms
23,400 KB
testcase_16 AC 25 ms
23,520 KB
testcase_17 AC 24 ms
23,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int a[101];
int n;

void sort(void){
	vpint ans;
	bool zerof = 1;
	bool flag = 1;
	for (int i = 0; flag; ++i){
		flag = 0;
		for (int j = n - 1; j >= i ; --j){
			if(a[j] < a[j - 1]){
				swap(a[j], a[j - 1]);
				ans.push_back(mp(j - 1, j));
				flag = 1;
				zerof = 0;
			}
		}
	}
	//rep(i, n) printf("%d", a[i]);
	int size = ans.size(); printf("%d\n", size);
	rep(i, size) printf("%d %d\n", ans[i].fi, ans[i].se);
	return;
}
int main(void){
	cin >> n;
	rep(i, n) cin >> a[i];
	sort();
	int d;
	cin >> d;
	return 0;

}
0