結果

問題 No.490 yukiソート
ユーザー 37zigen
提出日時 2017-03-10 23:07:57
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 2,341 ms
コンパイル使用メモリ 80,376 KB
実行使用メモリ 59,996 KB
最終ジャッジ日時 2024-06-24 10:21:39
合計ジャッジ時間 11,189 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 19 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
		}
		for (int i = 1; i < 2 * n - 3; ++i) {
			int s = 0;
			int t = i;
			while (t - s > 1) {
				if (t < n && a[s] > a[t]) {
					int d = a[s];
					a[s] = a[t];
					a[t] = d;
				}
				++s;
				--t;
			}
		}
		for (int i = 0; i < n; ++i) {
			System.out.print(a[i] + (i == n - 1 ? "\n" : " "));
		}
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
0