結果
問題 | No.490 yukiソート |
ユーザー |
|
提出日時 | 2017-03-10 23:09:07 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 334 ms / 2,000 ms |
コード長 | 730 bytes |
コンパイル時間 | 2,914 ms |
コンパイル使用メモリ | 80,128 KB |
実行使用メモリ | 58,128 KB |
最終ジャッジ日時 | 2024-06-24 10:22:35 |
合計ジャッジ時間 | 12,085 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
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)); } }