結果

問題 No.490 yukiソート
ユーザー tsunabittsunabit
提出日時 2019-06-12 00:28:44
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,038 bytes
コンパイル時間 3,681 ms
コンパイル使用メモリ 79,852 KB
実行使用メモリ 57,356 KB
最終ジャッジ日時 2024-04-16 22:06:05
合計ジャッジ時間 10,191 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,356 KB
testcase_01 AC 144 ms
41,500 KB
testcase_02 AC 143 ms
41,540 KB
testcase_03 AC 132 ms
40,512 KB
testcase_04 AC 223 ms
41,996 KB
testcase_05 AC 229 ms
41,624 KB
testcase_06 AC 229 ms
41,988 KB
testcase_07 AC 227 ms
42,056 KB
testcase_08 AC 223 ms
41,888 KB
testcase_09 AC 231 ms
41,932 KB
testcase_10 AC 234 ms
41,920 KB
testcase_11 AC 226 ms
41,888 KB
testcase_12 AC 229 ms
42,192 KB
testcase_13 AC 234 ms
41,932 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No490 {
    public static void main(String[] args) {
    	// 入力元がファイル
    	//        	File inputFile = new File("");
    	//        	Scanner sc = new Scanner(inputFile);
    	// 標準入力から読み込む際に、Scannerオブジェクトを使う。
    	Scanner sc = new Scanner(System.in);
    	int n = Integer.parseInt(sc.nextLine());
    	String[] a = sc.nextLine().split(" ");
    	int[] b = new int[n];
    	for(int i = 0; i < a.length; i++) {
    		b[i] = Integer.parseInt(a[i]);
    	}

    	for(int i = 1; i < (2 * n -3); i++) {
    		for(int p = 0; p < n; p++) {
    			for(int q = p; q <= (i - p); q++) {
    				if(q >= n) {
    					continue;
    				}
    				if(b[p] > b[q]) {
    					int temp = b[p];
    					b[p] = b[q];
    					b[q] = temp;
    				}
    			}
    		}
    	}
    	//            Arrays.sort(b);
    	for(int i = 0; i < n; i++) {
    		System.out.print(b[i] + " ");
    	}
    	System.out.println("");
    }
}
0