結果

問題 No.182 新規性の虜
ユーザー 37zigen37zigen
提出日時 2016-03-31 13:35:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 2,226 ms
コンパイル使用メモリ 75,864 KB
実行使用メモリ 65,740 KB
最終ジャッジ日時 2024-04-10 06:44:39
合計ジャッジ時間 15,090 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 133 ms
54,072 KB
testcase_02 AC 130 ms
54,140 KB
testcase_03 AC 136 ms
54,212 KB
testcase_04 AC 131 ms
54,292 KB
testcase_05 AC 135 ms
54,116 KB
testcase_06 AC 135 ms
54,288 KB
testcase_07 AC 137 ms
54,028 KB
testcase_08 AC 619 ms
60,524 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 133 ms
54,124 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 130 ms
54,336 KB
testcase_24 AC 673 ms
65,740 KB
testcase_25 AC 583 ms
59,456 KB
testcase_26 AC 321 ms
58,976 KB
testcase_27 AC 128 ms
53,904 KB
evil01.txt AC 766 ms
67,564 KB
evil02.txt AC 762 ms
67,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder182;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		PriorityQueue<Integer> pq=new PriorityQueue<>(n);
		for(int i=0;i<n;i++){
			pq.add(sc.nextInt());
		}
		int count=1;
		int memo=pq.poll();
		while(!pq.isEmpty()){
			int t=pq.poll();
			if(t!=memo){
				count++;
				memo=t;
			}else{
				count--;
				while(t==memo&&!pq.isEmpty()){
					memo=pq.poll();
				}
			}
		}
		System.out.println(count);
	}
}
0