結果

問題 No.182 新規性の虜
ユーザー dgd1724dgd1724
提出日時 2016-09-24 17:10:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 1,109 bytes
コンパイル時間 1,200 ms
コンパイル使用メモリ 96,036 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 12:58:22
合計ジャッジ時間 2,826 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 25 ms
4,376 KB
testcase_09 AC 39 ms
4,380 KB
testcase_10 AC 34 ms
4,376 KB
testcase_11 AC 28 ms
4,376 KB
testcase_12 AC 13 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 24 ms
4,380 KB
testcase_19 AC 18 ms
4,376 KB
testcase_20 AC 11 ms
4,376 KB
testcase_21 AC 27 ms
4,380 KB
testcase_22 AC 15 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 29 ms
4,376 KB
testcase_25 AC 17 ms
4,376 KB
testcase_26 AC 6 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
evil01.txt AC 39 ms
4,380 KB
evil02.txt AC 41 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES	//M_PI(π),M_SQRT2(√2)
#include <iostream>			//std::cout, std::cin
#include <string>			//std::string
#include <vector>			//std::vector
#include <valarray>			//std::valarray
#include <algorithm>		//std::sort
#include <time.h>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs,std::pow,sqrt,sin,cos,round,floor,ceil
#include <fstream>			//std::ifstream
#include <iomanip>			//std::setprecision
#include <random>			//std::random(C++11)
#include <numeric>			//std::accumulate

int main(void) {

	//test用
	//std::ifstream in("test.txt");
	//std::cin.rdbuf(in.rdbuf());

	//const unsigned int MODULO = 1000000007;	//MODULO 10^9+7用

	int N;
	std::cin >> N;
	std::vector<int> A(N);
	
	for (int i = 0; i < N; i++) {
		std::cin >> A[i];
	}
	std::sort(A.begin(), A.end());

	if (N != 1) {
		int ans = 0;
		if (A[0] != A[1]) {
			ans++;
		}
		for (int i = 1; i < N - 1; i++) {
			if (A[i - 1] != A[i] && A[i] != A[i + 1]) {
				ans++;
			}
		}
		if (A[N - 2] != A[N - 1]) {
			ans++;
		}
		std::cout << ans << std::endl;
	}
	else {
		std::cout << 1 << std::endl;
	}

}


0