結果
問題 | No.365 ジェンガソート |
ユーザー | keitamido |
提出日時 | 2017-06-10 15:44:32 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 698 bytes |
コンパイル時間 | 2,017 ms |
コンパイル使用メモリ | 75,000 KB |
実行使用メモリ | 76,884 KB |
最終ジャッジ日時 | 2023-10-24 20:30:42 |
合計ジャッジ時間 | 9,230 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
57,520 KB |
testcase_01 | AC | 125 ms
57,300 KB |
testcase_02 | AC | 125 ms
57,036 KB |
testcase_03 | AC | 128 ms
57,360 KB |
testcase_04 | AC | 126 ms
57,180 KB |
testcase_05 | AC | 128 ms
57,308 KB |
testcase_06 | AC | 128 ms
57,344 KB |
testcase_07 | AC | 128 ms
57,116 KB |
testcase_08 | AC | 130 ms
57,352 KB |
testcase_09 | AC | 117 ms
56,036 KB |
testcase_10 | AC | 128 ms
57,352 KB |
testcase_11 | AC | 116 ms
56,024 KB |
testcase_12 | AC | 129 ms
57,500 KB |
testcase_13 | AC | 132 ms
57,476 KB |
testcase_14 | AC | 127 ms
56,844 KB |
testcase_15 | AC | 138 ms
57,416 KB |
testcase_16 | AC | 538 ms
62,172 KB |
testcase_17 | TLE | - |
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 | -- | - |
ソースコード
import java.util.*; class JengaSortFix2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int max = sc.nextInt(); int cnt = max - 1; ArrayList<Integer> nlist = new ArrayList<Integer>(); nlist.add(sc.nextInt()); for (int i = 0; i < max - 1; i++) { int next = sc.nextInt(); if (next > JengaSortFix2.maxNum(nlist)) { if (nlist.contains(next - 1)) { cnt--; } else { cnt = max - 1; } nlist.add(next); } } System.out.println(cnt); } private static int maxNum(ArrayList<Integer> nlist) { int max = 0; for (Integer n : nlist) { int num = n.intValue(); if (num > max) { max = num; } } return max; } }