結果

問題 No.365 ジェンガソート
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-19 15:17:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 698 ms / 2,000 ms
コード長 733 bytes
コンパイル時間 2,204 ms
コンパイル使用メモリ 74,688 KB
実行使用メモリ 59,732 KB
最終ジャッジ日時 2024-04-28 19:08:33
合計ジャッジ時間 19,973 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
53,980 KB
testcase_01 AC 118 ms
52,724 KB
testcase_02 AC 137 ms
54,200 KB
testcase_03 AC 131 ms
54,048 KB
testcase_04 AC 130 ms
54,448 KB
testcase_05 AC 127 ms
53,792 KB
testcase_06 AC 134 ms
54,484 KB
testcase_07 AC 140 ms
54,340 KB
testcase_08 AC 134 ms
54,116 KB
testcase_09 AC 134 ms
54,296 KB
testcase_10 AC 136 ms
54,256 KB
testcase_11 AC 138 ms
54,048 KB
testcase_12 AC 120 ms
54,364 KB
testcase_13 AC 143 ms
53,880 KB
testcase_14 AC 139 ms
54,228 KB
testcase_15 AC 146 ms
54,004 KB
testcase_16 AC 674 ms
59,672 KB
testcase_17 AC 620 ms
59,572 KB
testcase_18 AC 272 ms
59,184 KB
testcase_19 AC 638 ms
59,732 KB
testcase_20 AC 386 ms
58,744 KB
testcase_21 AC 372 ms
59,284 KB
testcase_22 AC 637 ms
59,244 KB
testcase_23 AC 480 ms
59,404 KB
testcase_24 AC 568 ms
59,468 KB
testcase_25 AC 352 ms
58,884 KB
testcase_26 AC 586 ms
59,140 KB
testcase_27 AC 678 ms
59,424 KB
testcase_28 AC 567 ms
59,548 KB
testcase_29 AC 698 ms
59,444 KB
testcase_30 AC 563 ms
59,376 KB
testcase_31 AC 387 ms
59,024 KB
testcase_32 AC 374 ms
59,428 KB
testcase_33 AC 674 ms
59,436 KB
testcase_34 AC 329 ms
58,612 KB
testcase_35 AC 603 ms
59,216 KB
testcase_36 AC 538 ms
59,136 KB
testcase_37 AC 539 ms
58,872 KB
testcase_38 AC 660 ms
59,504 KB
testcase_39 AC 613 ms
59,728 KB
testcase_40 AC 647 ms
59,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		int a[]=new int[n];
		int max=0;
		int ind=0;
		for(int i=0;i<n;i++){
			a[i]=scanner.nextInt();
			if(a[i]>max){
				max=a[i];
				ind=i;
			}
		}
		int ax[]=deepCopy(a);
		Arrays.sort(ax);
		int oks=0;
		int j=ax.length-1;
		for(int i=ind;i>=0;i--){
			if(a[i]==ax[j]){
				oks++;
				j--;
			}
		}
		System.out.println(a.length-oks);
		
	}
	
	private static int[] deepCopy(int[] array) {
		int[] newArray = new int[array.length];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}
}
0