結果

問題 No.490 yukiソート
ユーザー ohreitetsu
提出日時 2017-11-20 16:32:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 59,228 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 03:21:02
合計ジャッジ時間 1,911 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	int n;
	cin>>n;
	vector<LL> A(n);
	int i;
	for (i=0;i<n;i++){
		cin>>A[i];
	}
	int p,q;
	for (i=0;i<2*n-3;i++){
		for (p=0;p<i+1;p++){
			q=i-p;
			if (q<n && p<q){
				if (A[p]>A[q]){
					swap(A[p],A[q]);
				}
			}
		}
	}
	for (i=0;i<n;i++){
		cout<<A[i];
		if (i<n-1){
			cout<<" ";
		}
	}
	cout<<endl;

	return 0;
}
0