結果
問題 | No.365 ジェンガソート |
ユーザー | Grenache |
提出日時 | 2016-04-29 22:26:07 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 229 ms / 2,000 ms |
コード長 | 1,618 bytes |
コンパイル時間 | 3,690 ms |
コンパイル使用メモリ | 78,588 KB |
実行使用メモリ | 49,764 KB |
最終ジャッジ日時 | 2024-04-20 06:30:22 |
合計ジャッジ時間 | 10,534 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 56 ms
37,328 KB |
testcase_01 | AC | 56 ms
37,116 KB |
testcase_02 | AC | 55 ms
36,960 KB |
testcase_03 | AC | 56 ms
37,092 KB |
testcase_04 | AC | 56 ms
36,988 KB |
testcase_05 | AC | 54 ms
37,144 KB |
testcase_06 | AC | 58 ms
37,056 KB |
testcase_07 | AC | 55 ms
36,920 KB |
testcase_08 | AC | 56 ms
36,708 KB |
testcase_09 | AC | 55 ms
37,004 KB |
testcase_10 | AC | 58 ms
36,860 KB |
testcase_11 | AC | 55 ms
36,856 KB |
testcase_12 | AC | 55 ms
37,328 KB |
testcase_13 | AC | 56 ms
37,148 KB |
testcase_14 | AC | 56 ms
37,048 KB |
testcase_15 | AC | 56 ms
36,928 KB |
testcase_16 | AC | 196 ms
46,288 KB |
testcase_17 | AC | 224 ms
49,104 KB |
testcase_18 | AC | 93 ms
39,288 KB |
testcase_19 | AC | 218 ms
48,924 KB |
testcase_20 | AC | 130 ms
41,660 KB |
testcase_21 | AC | 127 ms
41,080 KB |
testcase_22 | AC | 202 ms
46,416 KB |
testcase_23 | AC | 160 ms
45,648 KB |
testcase_24 | AC | 181 ms
45,416 KB |
testcase_25 | AC | 113 ms
40,820 KB |
testcase_26 | AC | 168 ms
45,032 KB |
testcase_27 | AC | 225 ms
48,964 KB |
testcase_28 | AC | 175 ms
46,232 KB |
testcase_29 | AC | 222 ms
49,764 KB |
testcase_30 | AC | 170 ms
44,828 KB |
testcase_31 | AC | 125 ms
41,076 KB |
testcase_32 | AC | 133 ms
41,540 KB |
testcase_33 | AC | 229 ms
49,276 KB |
testcase_34 | AC | 118 ms
40,220 KB |
testcase_35 | AC | 195 ms
46,308 KB |
testcase_36 | AC | 223 ms
49,140 KB |
testcase_37 | AC | 225 ms
49,036 KB |
testcase_38 | AC | 226 ms
49,140 KB |
testcase_39 | AC | 225 ms
49,456 KB |
testcase_40 | AC | 214 ms
49,080 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); } } }