結果

問題 No.182 新規性の虜
ユーザー cande398
提出日時 2018-03-09 23:53:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 315 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 66,140 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-10-10 20:58:56
合計ジャッジ時間 2,631 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:17: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   17 |         cout << ans << endl;
      |                 ^~~

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main(void)
{
	int N, tmp, ans;
	map<int, int> mp;
	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> tmp;
		mp[tmp] = mp[tmp] + 1;
	}
	for(auto itr = mp.begin(); itr != mp.end(); itr++) {
		if(itr->second == 1) ans++;
	}
	cout << ans << endl;
	return 0;
}
0