結果
問題 | No.365 ジェンガソート |
ユーザー | Grenache |
提出日時 | 2016-04-29 22:26:07 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 205 ms / 2,000 ms |
コード長 | 1,618 bytes |
コンパイル時間 | 3,633 ms |
コンパイル使用メモリ | 74,932 KB |
実行使用メモリ | 61,032 KB |
最終ジャッジ日時 | 2023-08-02 06:38:53 |
合計ジャッジ時間 | 10,687 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
49,608 KB |
testcase_01 | AC | 43 ms
49,288 KB |
testcase_02 | AC | 44 ms
49,344 KB |
testcase_03 | AC | 44 ms
49,420 KB |
testcase_04 | AC | 43 ms
49,292 KB |
testcase_05 | AC | 44 ms
49,544 KB |
testcase_06 | AC | 44 ms
49,396 KB |
testcase_07 | AC | 44 ms
49,508 KB |
testcase_08 | AC | 44 ms
49,440 KB |
testcase_09 | AC | 43 ms
49,416 KB |
testcase_10 | AC | 43 ms
49,604 KB |
testcase_11 | AC | 44 ms
49,456 KB |
testcase_12 | AC | 44 ms
49,376 KB |
testcase_13 | AC | 44 ms
49,568 KB |
testcase_14 | AC | 44 ms
49,368 KB |
testcase_15 | AC | 45 ms
49,332 KB |
testcase_16 | AC | 202 ms
58,564 KB |
testcase_17 | AC | 196 ms
60,480 KB |
testcase_18 | AC | 83 ms
52,120 KB |
testcase_19 | AC | 194 ms
60,936 KB |
testcase_20 | AC | 122 ms
54,752 KB |
testcase_21 | AC | 109 ms
54,708 KB |
testcase_22 | AC | 176 ms
57,976 KB |
testcase_23 | AC | 141 ms
57,080 KB |
testcase_24 | AC | 164 ms
58,928 KB |
testcase_25 | AC | 109 ms
55,044 KB |
testcase_26 | AC | 157 ms
58,208 KB |
testcase_27 | AC | 204 ms
60,424 KB |
testcase_28 | AC | 159 ms
57,060 KB |
testcase_29 | AC | 201 ms
60,840 KB |
testcase_30 | AC | 160 ms
57,960 KB |
testcase_31 | AC | 115 ms
54,356 KB |
testcase_32 | AC | 120 ms
54,564 KB |
testcase_33 | AC | 205 ms
60,744 KB |
testcase_34 | AC | 101 ms
52,868 KB |
testcase_35 | AC | 175 ms
58,340 KB |
testcase_36 | AC | 203 ms
60,632 KB |
testcase_37 | AC | 191 ms
60,612 KB |
testcase_38 | AC | 195 ms
58,916 KB |
testcase_39 | AC | 198 ms
58,776 KB |
testcase_40 | AC | 196 ms
61,032 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder365 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int cnt = 0; int x = n; for (int i = n - 1; i >= 0; i--) { if (a[i] == x) { cnt++; x--; } } pr.println(n - cnt); pr.close(); sc.close(); } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator<String> it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { it = Arrays.asList(br.readLine().split(" ")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }