結果
問題 |
No.182 新規性の虜
|
ユーザー |
![]() |
提出日時 | 2018-03-09 23:59:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 414 bytes |
コンパイル時間 | 680 ms |
コンパイル使用メモリ | 70,120 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2025-04-20 10:43:07 |
合計ジャッジ時間 | 3,123 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:21:41: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 21 | if(itr->second == 1) ans++; | ~~~^~ main.cpp:7:21: note: ‘ans’ was declared here 7 | int N, tmp, ans; | ^~~
ソースコード
#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; }