結果
問題 | No.490 yukiソート |
ユーザー |
|
提出日時 | 2017-06-15 22:41:37 |
言語 | C++11 (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 928 bytes |
コンパイル時間 | 645 ms |
コンパイル使用メモリ | 87,192 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 03:09:27 |
合計ジャッジ時間 | 4,139 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 5 WA * 9 RE * 20 |
ソースコード
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include <sstream> #include<iomanip> //#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int>a; vector<int>x[2005]; for (int i = 0; i < n; i++) { int t; cin >> t; a.push_back(t); x[t].push_back(i); } bool f = 0; do{ f = 0; for (int i = 0; i < n; i++) { for (int j = 0; j + i < 2 * n - 3; j++) { if (j >= i - j)break; if (a[j] > a[i - j]) { swap(a[j], a[i - j]); f = 1; } } /* for (int k = 0; k < n; k++) { cout << a[k] << " "; } cout << endl; */ } }while (f); for (int k = 0; k < n; k++) { if (k)cout << " "; cout << a[k]; } cout << endl; return 0; }