結果

問題 No.490 yukiソート
ユーザー mosmos_21mosmos_21
提出日時 2017-06-19 22:36:20
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 2,343 ms
コンパイル使用メモリ 74,540 KB
実行使用メモリ 45,916 KB
最終ジャッジ日時 2024-04-10 06:15:50
合計ジャッジ時間 9,970 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
41,272 KB
testcase_01 AC 124 ms
41,172 KB
testcase_02 AC 129 ms
41,388 KB
testcase_03 AC 131 ms
41,416 KB
testcase_04 AC 194 ms
42,080 KB
testcase_05 AC 186 ms
42,308 KB
testcase_06 AC 183 ms
42,124 KB
testcase_07 AC 190 ms
43,568 KB
testcase_08 AC 187 ms
42,408 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 191 ms
41,984 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 127 ms
41,288 KB
testcase_25 AC 126 ms
41,780 KB
testcase_26 WA -
testcase_27 AC 124 ms
41,488 KB
testcase_28 AC 128 ms
41,428 KB
testcase_29 WA -
testcase_30 AC 115 ms
41,596 KB
testcase_31 WA -
testcase_32 AC 125 ms
41,316 KB
testcase_33 WA -
testcase_34 AC 113 ms
41,584 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
       int n = in.nextInt();
       int[] a = new int[n];
       for(int i = 0; i < n; i++){
           a[i] = in.nextInt();
       }

       for(int i = 0; i < 2 * n - 3; i++){
           for(int j = (i + 1) / 2; j <= i; j++){
               int q = j;
               int p = i - q;
               if(q < n - 1 && a[p] > a[q]){
                   int t = a[p];
                   a[p] = a[q];
                   a[q] = t;
               }
           }
       }
       for(int i = 0; i < a.length; i++){
           if(i != 0){
               System.out.print(" ");
           }
           System.out.print(a[i]);
       }
       System.out.println();
    }


}
0