結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2019-05-11 13:03:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 2,351 bytes |
コンパイル時間 | 675 ms |
コンパイル使用メモリ | 74,144 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 01:09:45 |
合計ジャッジ時間 | 1,875 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#pragma region include#include <iostream>#include <vector>#include <algorithm>#include <map>#include <string>#include <queue>#include <stack>#include <cmath>#include <set>#include <cstdio>#define ALL(obj) (obj).begin(),(obj).end()#define RALL(obj) (obj).rbegin(),(obj).rend()#define REP(i, n) for(int i = 0; i < n; i++)#define REPR(i, n) for(int i = n; i >= 0; i--)#define FOR(i, m, n) for(int i = m; i < n; i++)#define MOD 1000000007#define INF 1000000000#define LLINF 4000000000000000000using namespace std;typedef long long ll;typedef pair<int, int> PII;typedef vector<int> VI;typedef vector<VI> VVI;#pragma endregion//#define __DEBUG__#ifdef __DEBUG__#define dump(x) cerr << #x << " = " << (x) << " [" << __LINE__ << ":" << __FUNCTION__ << "] " << endl;// vector出力template<typename T>ostream& operator << (ostream& os, vector<T>& v) {os << "{";REP(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }os << "}";return os;}// pair出力template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& p) {return os << "(" << p.first << ", " << p.second << ")";}// map出力template<typename T, typename U>ostream& operator << (ostream& os, map<T, U>& map_var) {os << "{";for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {os << "(" << itr->first << ", " << itr->second << ")";itr++;if (itr != map_var.end()) os << ", ";itr--;}os << "}";return os;}// set 出力template<typename T>ostream& operator << (ostream& os, set<T>& set_var) {os << "{";for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {os << *itr;++itr;if (itr != set_var.end()) os << ", ";itr--;}os << "}";return os;}#endifint main() {cin.tie(0); ios::sync_with_stdio(false);int n;cin >> n;VI a(n);for (int i = 0; i < n; i++){cin >> a[i];}for (int i = 1; i < 2 * n - 3; i++){for (int p = 0; p < n; p++){int q = i - p;if (q < n && q > p && a[q] < a[p]) {swap(a[q], a[p]);}}}for (int i = 0; i < n; i++){cout << a[i] << " ";}cout << endl;getchar(); getchar();}