結果

問題 No.182 新規性の虜
ユーザー AQUA16573837AQUA16573837
提出日時 2018-03-13 01:29:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 449 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 40,140 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 18:24:40
合計ジャッジ時間 1,207 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,816 KB
testcase_01 AC 0 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 0 ms
6,944 KB
testcase_06 AC 0 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 10 ms
6,940 KB
testcase_09 AC 15 ms
6,940 KB
testcase_10 AC 14 ms
6,944 KB
testcase_11 AC 11 ms
6,940 KB
testcase_12 AC 5 ms
6,940 KB
testcase_13 AC 0 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 0 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 11 ms
6,944 KB
testcase_19 AC 8 ms
6,944 KB
testcase_20 AC 5 ms
6,940 KB
testcase_21 AC 12 ms
6,940 KB
testcase_22 AC 7 ms
6,940 KB
testcase_23 AC 0 ms
6,940 KB
testcase_24 AC 11 ms
6,940 KB
testcase_25 AC 9 ms
6,940 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 1 ms
6,944 KB
evil01.txt AC 13 ms
6,940 KB
evil02.txt AC 13 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%d", A + i);
      |                 ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#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