結果

問題 No.1380 Borderline
ユーザー xRS43BofaUEZ5gc
提出日時 2021-03-05 09:48:15
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 593 bytes
コンパイル時間 3,657 ms
コンパイル使用メモリ 74,800 KB
実行使用メモリ 54,748 KB
最終ジャッジ日時 2024-10-06 04:58:48
合計ジャッジ時間 11,855 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36 RE * 5
権限があれば一括ダウンロードができます

ソースコード

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 (pi[i - 1] != pi[i]) {
	    			System.out.println(n - i);
	    			break;
	    		}
	    		if (i == n - 1) {System.out.println(0);}
	    	}

	    	}

	    }
0