結果
問題 | No.490 yukiソート |
ユーザー |
|
提出日時 | 2017-03-11 00:59:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 2,130 bytes |
コンパイル時間 | 1,736 ms |
コンパイル使用メモリ | 176,868 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 11:53:33 |
合計ジャッジ時間 | 2,734 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS#define _USE_MATH_DEFINES#include "bits/stdc++.h"#include <random>using namespace std;#define rep(i,n) for(int i=0;i<(n);++i)#define rep2(i,a,b) for(int i=(a);i<(b);++i)#define rrep(i,n) for(int i=(n)-1;i>=0;--i)#define rrep2(i,a,b) for(int i=(a)-1;i>=b;--i)#define range(i,a,b,c) for(int i=a;\c>0?i<b:\i>b;\i+=c)#define chmax(a, b) (a = (a) < (b) ? (b) : (a))#define chmin(a, b) (a = (a) > (b) ? (b) : (a))using ll = long long;using ull = unsigned long long;using ld = long double;#define all(a) begin(a),end(a)#define ifnot(a) if(not (a))#define dump(x) cerr << #x << " = " << (x) << endl#define int long long#ifdef _MSC_VERconst bool test = true;#elseconst bool test = false;#endifint dx[] = { 1,0,-1,0 };int dy[] = { 0,1,0,-1 };const int INF = 1 << 28;const ll INFL = (ll)1 << 58;ll mod = (int)1e9 + 7;const double eps = 1e-10;typedef long double Real;// return -1, 0, 1int sgn(const Real& r) { return (r > eps) - (r < -eps); }int sgn(const Real& a, const Real &b) { return sgn(a - b); }//.....................const int MAX = (int)2e5 + 5;vector<string> split(const string &str, char sep) {vector<string> v;stringstream ss(str);string buffer;while (getline(ss, buffer, sep)) {v.push_back(buffer);}return v;}template<class InputIterator>int sum(InputIterator begin, InputIterator end) {return accumulate(begin, end, 0ll);}int n;vector<int> a;void yuki_sort() {rep(i, 2 * n - 3) {rep(p, n) {int q = i - p;ifnot (0 <= q) continue;ifnot (q < n) continue;ifnot (p < q) continue;if (a[p] > a[q]) {swap(a[p], a[q]);}}}}void solve() {cin >> n;a.resize(n);rep(i, n) cin >> a[i];yuki_sort();cout << a[0];rep2(i, 1, n) cout << " " << a[i];cout << endl;}signed main() {srand(time(NULL));int T = 100;cout << fixed << setprecision(15);rep(i, T) {char s[MAX];if (scanf("%s", s) == EOF) break;int n = strlen(s);for (int i = n - 1; i > -1; i--) {ungetc(s[i], stdin);}solve();}return 0;}