結果
問題 | No.490 yukiソート |
ユーザー |
|
提出日時 | 2017-03-10 23:35:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 849 bytes |
コンパイル時間 | 662 ms |
コンパイル使用メモリ | 73,524 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 10:26:50 |
合計ジャッジ時間 | 1,942 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 34 |
ソースコード
#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<string>#include<stack>#include<queue>#include<vector>typedef long long int ll;using namespace std;#define FOR(i,a,b) for (int i=(a);i<(b);i++)#define REP(i,n) for (int i=0;i<(n);i++)#define EREP(i,n) for (int i=1;i<=(n);i++)const int MOD = 1000000007;const int INF = 1000000;ll a,b,ans,M,temp;ll A[5010];int N;int p,q;int main(){scanf("%d",&N);REP(i,N)scanf("%lld",&A[i]);EREP(i,2*N-4){if(i<N){p=i;q=0;}else { q=i-N+1;p=i-q-1;}REP(j,i+1){if(A[p]>A[q]){int temp=A[q];A[q]=A[p];A[p]=temp;}p--;q++;if(p==0){break;}}}REP(i,N)printf("%lld",A[i]);return 0;}