結果
問題 | No.182 新規性の虜 |
ユーザー |
![]() |
提出日時 | 2018-03-09 23:59:59 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 80 ms / 5,000 ms |
コード長 | 414 bytes |
コンパイル時間 | 547 ms |
コンパイル使用メモリ | 66,544 KB |
実行使用メモリ | 8,064 KB |
最終ジャッジ日時 | 2024-10-10 21:17:20 |
合計ジャッジ時間 | 2,269 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:23:17: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 23 | cout << ans << endl; | ^~~
ソースコード
#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; auto itr = mp.find(tmp); if(itr != mp.end()) { mp[itr->first] = mp[itr->first] + 1; } else { mp[tmp] = 1; } } for(auto itr = mp.begin(); itr != mp.end(); itr++) { if(itr->second == 1) ans++; } cout << ans << endl; return 0; }