結果

問題 No.182 新規性の虜
ユーザー Yang33
提出日時 2016-01-06 11:01:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 59,572 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 12:08:39
合計ジャッジ時間 1,757 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
	int n, i, ans;
	long long int pa[100005] = {0};

	cin >> n;
	ans = n;
	for (i = 0; i < n; i++) {
		cin >> pa[i];
	}
	sort(pa, pa + n);
	for (i = 0; i < n - 1; i++) {
		if (pa[i] == pa[i + 1])
			ans -= 2;
		if (pa[i] == pa[i + 1] && pa[i + 1] == pa[i + 2])
			ans += 1;
	}
	if (pa[0] == pa[n - 1])
		ans = 0;
	cout << ans << endl;


	return 0;
}
0