結果
問題 | No.490 yukiソート |
ユーザー |
|
提出日時 | 2018-06-22 17:07:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 533 ms |
コンパイル使用メモリ | 70,132 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 18:00:28 |
合計ジャッジ時間 | 1,672 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <iostream>#include <algorithm>#include <vector>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 <= i; p++){int q = i - p;if(q >= n || q < 0 || p >= n || p < 0 || p >= q || a[p] <= a[q]){continue;}swap(a[p], a[q]);}}for(int i = 0; i < n - 1; i++){cout << a[i] << " ";}cout << a[n - 1] << endl;}