結果
| 問題 | No.490 yukiソート |
| コンテスト | |
| ユーザー |
teketeke5000
|
| 提出日時 | 2017-10-24 21:35:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 1,162 ms |
| コンパイル使用メモリ | 159,344 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-21 17:49:45 |
| 合計ジャッジ時間 | 2,501 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void) {
int n;
cin >> n;
ll a[n];
for (int i=0; i<n; i++) cin >> a[i];
for (int i=1; i < 2 * n - 3; i++) {
int p = (n-1)-i >= 0 ? 0 : i-(n-1);
int q = i - p;
while (p < q) {
if (a[p] > a[q]) swap(a[p], a[q]);
p++; q--;
}
}
for (int i=0; i<n; i++) cout << a[i] << " ";
cout << endl;
return 0;
}
teketeke5000