結果

問題 No.490 yukiソート
ユーザー rogi52
提出日時 2022-09-27 02:00:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 194,408 KB
最終ジャッジ日時 2025-02-07 16:41:39
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    for(int i = 1; i < 2 * n - 3; i++) {
        for(int p = 0; p < n; p++) {
            int q = i - p;
            if(0 <= q && p < q && q < n) {
                if(a[p] > a[q]) swap(a[p], a[q]);
            }
        }
    }
    rep(i,n) cout << a[i] << " "; cout << endl;
}
0