結果

問題 No.182 新規性の虜
コンテスト
ユーザー AQUA16573837
提出日時 2018-03-13 01:29:49
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 449 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 564 ms
コンパイル使用メモリ 63,280 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-11 01:05:50
合計ジャッジ時間 2,120 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <algorithm>
#include <deque>
using namespace std;
using ll = long long;
int main() {
	int n, A[100000], count = 0;
	scanf("%d", &n);
	if (n == 1) {
		printf("1\n");
		return 0;
	}
	for (int i = 0; i < n; i++)
		scanf("%d", A + i);

	sort(A, A + n);
	for (int i = 1; i < (n - 1); i++)
		if (A[i - 1] != A[i] && A[i] != A[i + 1])
			count++;
	count += A[0] != A[1];
	count += A[n - 1] != A[n - 2];
	printf("%d\n", count);
}
0