結果

問題 No.365 ジェンガソート
ユーザー takeya_okinotakeya_okino
提出日時 2017-10-27 21:06:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 637 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 3,559 ms
コンパイル使用メモリ 74,112 KB
実行使用メモリ 49,396 KB
最終ジャッジ日時 2024-05-01 16:16:07
合計ジャッジ時間 20,027 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,260 KB
testcase_01 AC 129 ms
41,372 KB
testcase_02 AC 116 ms
41,444 KB
testcase_03 AC 127 ms
41,168 KB
testcase_04 AC 130 ms
41,852 KB
testcase_05 AC 118 ms
40,408 KB
testcase_06 AC 126 ms
41,432 KB
testcase_07 AC 129 ms
41,452 KB
testcase_08 AC 129 ms
41,616 KB
testcase_09 AC 115 ms
40,272 KB
testcase_10 AC 121 ms
40,784 KB
testcase_11 AC 126 ms
41,232 KB
testcase_12 AC 120 ms
40,016 KB
testcase_13 AC 132 ms
41,752 KB
testcase_14 AC 116 ms
40,328 KB
testcase_15 AC 135 ms
41,596 KB
testcase_16 AC 573 ms
48,768 KB
testcase_17 AC 625 ms
49,196 KB
testcase_18 AC 261 ms
47,276 KB
testcase_19 AC 542 ms
49,112 KB
testcase_20 AC 364 ms
48,044 KB
testcase_21 AC 378 ms
48,580 KB
testcase_22 AC 602 ms
48,852 KB
testcase_23 AC 476 ms
48,256 KB
testcase_24 AC 568 ms
48,992 KB
testcase_25 AC 352 ms
48,644 KB
testcase_26 AC 547 ms
48,464 KB
testcase_27 AC 632 ms
49,112 KB
testcase_28 AC 540 ms
48,648 KB
testcase_29 AC 609 ms
49,064 KB
testcase_30 AC 569 ms
48,572 KB
testcase_31 AC 382 ms
48,148 KB
testcase_32 AC 397 ms
48,488 KB
testcase_33 AC 603 ms
49,028 KB
testcase_34 AC 318 ms
48,060 KB
testcase_35 AC 585 ms
48,748 KB
testcase_36 AC 519 ms
47,612 KB
testcase_37 AC 489 ms
48,316 KB
testcase_38 AC 637 ms
48,944 KB
testcase_39 AC 594 ms
49,396 KB
testcase_40 AC 540 ms
48,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    int[] b = new int[n];
    for(int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
      b[i] = a[i];
    }
    Arrays.sort(b);
    int count = 0;
    int p = n - 1;
    for(int i = n - 1; i >= 0; i--) {
      if(a[i] == b[p]) {
        count++;
        p--;
      }
    }
    System.out.println(n - count);
  }
}
0