結果
問題 | No.365 ジェンガソート |
ユーザー | tamago324_pad |
提出日時 | 2016-06-03 22:16:48 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 706 bytes |
コンパイル時間 | 2,590 ms |
コンパイル使用メモリ | 75,728 KB |
実行使用メモリ | 41,648 KB |
最終ジャッジ日時 | 2024-04-16 23:48:05 |
合計ジャッジ時間 | 8,843 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 139 ms
41,392 KB |
testcase_01 | AC | 137 ms
40,912 KB |
testcase_02 | AC | 138 ms
41,092 KB |
testcase_03 | AC | 144 ms
40,876 KB |
testcase_04 | AC | 141 ms
41,360 KB |
testcase_05 | AC | 142 ms
41,164 KB |
testcase_06 | AC | 138 ms
41,360 KB |
testcase_07 | AC | 140 ms
41,412 KB |
testcase_08 | AC | 138 ms
41,088 KB |
testcase_09 | AC | 139 ms
41,172 KB |
testcase_10 | AC | 139 ms
41,016 KB |
testcase_11 | AC | 142 ms
41,444 KB |
testcase_12 | AC | 142 ms
41,180 KB |
testcase_13 | AC | 147 ms
41,280 KB |
testcase_14 | AC | 141 ms
41,648 KB |
testcase_15 | AC | 154 ms
41,608 KB |
testcase_16 | TLE | - |
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 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
ソースコード
// No.365 import java.util.Scanner; import java.util.ArrayList; class JengaSort{ public static void main(String[] args){ ArrayList<Integer> jengaList = new ArrayList<>(); Scanner scan = new Scanner(System.in); int result = 0; int max = scan.nextInt(); for(int i = 0; i < max; i++){ jengaList.add(scan.nextInt()); } for(int i = max - 1; i > 0; i--){ Integer iIndex = jengaList.indexOf(i); Integer nIndex = jengaList.indexOf(i + 1); if(iIndex > nIndex){ // 左にもっていく while(iIndex > 0){ Integer before = jengaList.set(iIndex - 1, i); jengaList.set(iIndex, before); iIndex--; } result++; } } System.out.println(result); } }