結果

問題 No.2289 順列ソート
ユーザー vjudge1
提出日時 2025-10-04 15:38:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 157,772 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-04 15:38:56
合計ジャッジ時間 2,943 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int a[110];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];
	}
	int cnt=0;
	for (int i=1;i<=n;i++){
		for (int j=i+1;j<=n;j++){
			if (a[i]>a[j]){
				swap(a[i],a[j]);
				cnt++;
			}
		}
	}
	cout<<cnt;
	return 0;
}
0