結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2017-03-16 13:04:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,038 ms / 2,000 ms |
コード長 | 933 bytes |
コンパイル時間 | 429 ms |
コンパイル使用メモリ | 56,136 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 02:36:42 |
合計ジャッジ時間 | 11,884 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include<iostream>using namespace std;int main(){int n, a[5000],b=0,c=0,cnt1=0,cnt2=0;cin >> n;for (int z = 0; z < n; z++) cin >> a[z];for (int i = 0; i < 2 * n - 3; i++){for (int p = 0; p < n - 1; p++) //n-1{for (int q = i - p; (q > p)&& (q<n); q++){if(a[p]>a[q])swap(a[p],a[q]);/*cnt1++;if (a[p] <= a[q]) break;cnt2++;*/}}/*if (cnt1 = cnt2){for (int x = 0; x < n - 1;x++){for (int y = i - x; y < x; y++){a[x] = b, a[y] = c;a[x] = c, a[y] = b;}}}*/}for (int m = 0; m < n - 1; m++){cout << a[m]<<" ";}cout << a[n - 1] << endl;}