結果

問題 No.182 新規性の虜
コンテスト
ユーザー koba-e964
提出日時 2015-05-04 21:46:02
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 197 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 502 ms
コンパイル使用メモリ 78,720 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-27 04:26:00
合計ジャッジ時間 1,736 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 3 WA * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/set:65,
                 from main.cpp:1:
In member function 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]',
    inlined from 'int main()' at main.cpp:9:62:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_set.h:536:32: warning: 't' may be used uninitialized [-Wmaybe-uninitialized]
  536 |           _M_t._M_insert_unique(__x);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/set:64:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_tree.h: In function 'int main()':
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_tree.h:2784:5: note: by argument 2 of type 'const int&' to 'std::pair<typename std::__rb_tree::_Node_traits<_Val, typename __gnu_cxx::__alloc_traits<typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Val>::other>::pointer>::_Iterator, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const int&; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]' declared here
 2784 |     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:26: note: 't' declared here
    9 | for(int i=0;i<n;i++){int t;if(a.count(t))b.insert(t);a.insert(t);}
      |                          ^
In member function 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_t

ソースコード

diff #
raw source code

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

int main(){
int n;
cin>>n;
set<int> a,b;
for(int i=0;i<n;i++){int t;if(a.count(t))b.insert(t);a.insert(t);}
cout<<a.size()-b.size()<<endl;
}
0