結果

問題 No.182 新規性の虜
ユーザー 37zigen
提出日時 2016-03-31 13:35:04
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 2,224 ms
コンパイル使用メモリ 75,648 KB
実行使用メモリ 61,432 KB
最終ジャッジ日時 2024-10-02 08:24:37
合計ジャッジ時間 15,074 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 14 WA * 13
権限があれば一括ダウンロードができます

ソースコード

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