結果

問題 No.490 yukiソート
ユーザー face4face4
提出日時 2018-04-27 19:42:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 534 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 65,024 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 21:46:22
合計ジャッジ時間 1,787 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 20
権限があれば一括ダウンロードができます

ソースコード

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 <= n-1; p++){
            int q = i-p;
            if(p >= q || q < 0 || q > n){
                continue;
            }

            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