結果

問題 No.1380 Borderline
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-05 09:50:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 3,446 ms
コンパイル使用メモリ 75,388 KB
実行使用メモリ 42,096 KB
最終ジャッジ日時 2024-04-15 22:42:21
合計ジャッジ時間 11,061 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,568 KB
testcase_01 AC 130 ms
41,552 KB
testcase_02 AC 134 ms
41,520 KB
testcase_03 AC 135 ms
41,280 KB
testcase_04 AC 132 ms
41,384 KB
testcase_05 AC 133 ms
41,872 KB
testcase_06 AC 133 ms
41,140 KB
testcase_07 AC 134 ms
41,144 KB
testcase_08 AC 132 ms
41,516 KB
testcase_09 AC 131 ms
41,600 KB
testcase_10 AC 130 ms
41,492 KB
testcase_11 AC 131 ms
41,436 KB
testcase_12 AC 133 ms
41,644 KB
testcase_13 AC 131 ms
41,400 KB
testcase_14 AC 143 ms
41,468 KB
testcase_15 AC 144 ms
41,744 KB
testcase_16 AC 142 ms
41,720 KB
testcase_17 AC 145 ms
41,752 KB
testcase_18 AC 156 ms
41,636 KB
testcase_19 AC 142 ms
41,516 KB
testcase_20 AC 146 ms
41,776 KB
testcase_21 AC 144 ms
41,844 KB
testcase_22 AC 142 ms
41,620 KB
testcase_23 AC 144 ms
41,796 KB
testcase_24 AC 143 ms
41,500 KB
testcase_25 AC 145 ms
41,612 KB
testcase_26 AC 142 ms
41,492 KB
testcase_27 AC 141 ms
41,632 KB
testcase_28 AC 142 ms
41,384 KB
testcase_29 AC 142 ms
41,992 KB
testcase_30 AC 143 ms
41,616 KB
testcase_31 AC 143 ms
41,912 KB
testcase_32 AC 145 ms
41,528 KB
testcase_33 AC 144 ms
41,584 KB
testcase_34 AC 145 ms
41,816 KB
testcase_35 AC 142 ms
41,256 KB
testcase_36 AC 145 ms
41,560 KB
testcase_37 AC 145 ms
41,612 KB
testcase_38 AC 145 ms
41,816 KB
testcase_39 AC 150 ms
41,364 KB
testcase_40 AC 147 ms
41,928 KB
testcase_41 AC 147 ms
41,336 KB
testcase_42 AC 143 ms
42,092 KB
testcase_43 AC 146 ms
42,096 KB
testcase_44 AC 133 ms
41,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class HelloWorld {

	    public static void main(String[] args) throws Exception {

	    	Scanner sc = new Scanner(System.in);
	    	int n = sc.nextInt();
	    	int k = sc.nextInt();
	    	int[] pi = new int[n];

	    	for (int i=0; i < n; i ++) {
	    		pi[i] = sc.nextInt();
	    	}
	    	sc.close();
	    	Arrays.sort(pi);

	    	for (int i = n - k; i  < n ; i ++) {
	    		if (n ==k) {
	    			System.out.println(k);
	    			break;
	    		}
	    		if (pi[i - 1] != pi[i]) {
	    			System.out.println(n - i);
	    			break;
	    		}
	    		if (i == n - 1) {System.out.println(0);}
	    	}

	    	}

	    }
0