結果

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

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second

int n,a[105],dummy;
vector<pii>v;

void Sort(int a[],int n)
{
	bool flag=true;
	for(int i=0;i<flag;i++)
	{
		flag=false;
		for(int j=n-1;j>=i;j--)
		if(a[j]<a[j-1])
		{
			swap(a[j],a[j-1]);
			v.pb(mp(j,j-1));
			flag=true;
		}
	}
}

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	Sort(a,n);
	cout<<v.size()<<endl;
	for(int i=0;i<v.size();i++)cout<<v[i].fi<<" "<<v[i].se<<endl;
	cin>>dummy;
	return 0;
}
0