結果

問題 No.490 yukiソート
ユーザー face4face4
提出日時 2018-04-27 19:30:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 64,512 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-06-27 21:45:57
合計ジャッジ時間 8,935 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 2 WA * 2 RE * 12 TLE * 2 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int n;
    cin >> n;
    int A[n];
    for(int i = 0; i < n; i++)  cin >> A[i];

    for(int i = 1; i < 2*n-3; i++){
        for(int p = 0; p <= min(n-1, i); p++){
            for(int q = p+1; q <= i-p; q++){
                if(A[p] > A[q]){
                    swap(A[p], A[q]);
                }
            }
        }
    }

    for(int i = 0; i < n; i++){
        cout << ((i == 0) ? "" : " ") << A[i];
    }

    cout << endl;
    return 0;
}
0