結果
| 問題 |
No.490 yukiソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-28 21:40:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| コンパイル時間 | 512 ms |
| コンパイル使用メモリ | 59,496 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 13:28:07 |
| 合計ジャッジ時間 | 1,693 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 19 |
ソースコード
#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 = 0; 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;
}