結果

問題 No.490 yukiソート
コンテスト
ユーザー fjafjafja
提出日時 2017-08-31 15:04:41
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 489 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,505 ms
コンパイル使用メモリ 82,932 KB
実行使用メモリ 47,592 KB
最終ジャッジ日時 2026-05-06 21:12:36
合計ジャッジ時間 9,802 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package yukicoder;

import java.util.Scanner;

public class N490
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int buf=0;
		int[] a=new int[N];
		for(int i=0;i<N;i++)
		{
			a[i]=sc.nextInt();
		}

		for(int i=0;i<2*N-3;i++)
		{
			int s=0,t=i;
			while(s<t)
			{
				if(t<=N-1&&a[s]>a[t]){buf=a[s];a[s]=a[t];a[t]=buf;}
				s++;
				t=i-s;
			}
		}
		for(int aa:a)
		{
			System.out.print(aa+" ");
		}System.out.println();

	}

}
0