結果
| 問題 |
No.490 yukiソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-28 22:11:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 498 bytes |
| コンパイル時間 | 564 ms |
| コンパイル使用メモリ | 60,632 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 13:31:16 |
| 合計ジャッジ時間 | 1,867 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
int p = 0,tmp = 0;
cin >> n;
vector<int> a(n,0);
for(int d = 0; d < n; d++){
cin >> a[d];
}
for(int i = 1; i < 2*n-3;i++){
for(int q = 1; q <= n - 1; q++){
p = i-q;
if(p >= 0 && q < n && p < q){
//cout << "p:"<<p << " q:" << q << endl;
if(a[p] > a[q]){
tmp = a[p];
a[p] = a[q];
a[q] = tmp;
}
}
}
}
for(auto e : a) cout << e << " ";
cout << endl;
return 0;
}