結果
| 問題 | No.490 yukiソート |
| コンテスト | |
| ユーザー |
maroon_kuri
|
| 提出日時 | 2017-03-10 22:33:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 1,626 bytes |
| 記録 | |
| コンパイル時間 | 2,021 ms |
| コンパイル使用メモリ | 170,316 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 10:01:14 |
| 合計ジャッジ時間 | 2,960 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;
template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
os<<"("<<p.first<<","<<p.second<<")";
return os;
}
template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
os<<"[";
REP(i,(int)v.size()){
if(i)os<<",";
os<<v[i];
}
os<<"]";
return os;
}
int read(){
int i;
scanf("%lld",&i);
return i;
}
void printSpace(){
printf(" ");
}
void printEoln(){
printf("\n");
}
void print(int x,int suc=1){
printf("%lld",x);
if(suc==1)
printEoln();
if(suc==2)
printSpace();
}
string readString(){
static char buf[3341919];
scanf("%s",buf);
return string(buf);
}
char* readCharArray(){
static char buf[3341919];
static int bufUsed=0;
char* ret=buf+bufUsed;
scanf("%s",ret);
bufUsed+=strlen(ret)+1;
return ret;
}
template<class T,class U>
void chmax(T& a,U b){
if(a<b)
a=b;
}
template<class T,class U>
void chmin(T& a,U b){
if(a>b)
a=b;
}
template<class T>
T Sq(const T& t){
return t*t;
}
const int inf=LLONG_MAX/3;
signed main(){
int n=read();
vi a;
REP(i,n)a.PB(read());
FOR(i,1,2*n-3)
FOR(p,max(i-(n-1),0LL),min(n-1,i)){
int q=i-p;
if(q<=p)break;
if(a[p]>a[q])swap(a[p],a[q]);
}
REP(i,n)
print(a[i],i==n-1?1:2);
}
maroon_kuri