結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2018-01-06 21:52:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 515 ms |
コンパイル使用メモリ | 74,896 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 08:54:46 |
合計ジャッジ時間 | 1,512 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <iostream>#include <iomanip>#include <vector>#include <algorithm>#include <string>#include <sstream>#include <cmath>#include <stack>#include <cctype>#include <stdio.h>using namespace std;int main() {int n = 0;cin >> n;long a[n];long tmp=0;for(int i=0; i<n;i++){cin>>tmp;a[i] =tmp;}for(int i=1; i<2*n-3; i++){for(int p=0; p<=n-1; p++){int q = i-p;if(p>q && q >=0 /*&& p<=n-1*/){if(a[q]>a[p]){swap(a[q],a[p]);}}}}for(int i=0; i<n;i++){cout<<a[i]<<" ";}cout<<endl;return 0;}