제출 #796226

#제출 시각아이디문제언어결과실행 시간메모리
796226ln_e드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho #include "insects.h" using ll=long long; using ld=long double; int const INF=1000000005; ll const LINF=1000000000000000005; ll const mod=1000000007; ld const PI=3.14159265359; ll const MAX_N=3e5+5; ld const EPS=0.00000001; #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define f first #define s second #define pb push_back #define mp make_pair #define endl '\n' #define sz(a) (int)a.size() #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; int min_cardinality(int N) { vector<ll>v; v.pb(0); move_inside(0); for(ll i=1;i<N;i++){ move_inside(i); ll x=press_button(); if(x>1){ move_outside(i); }else { v.pb(i); } } map<ll,ll>viz; for(auto it : v){ viz[it]=1; move_outside(it); } set<ll>possible; for(ll i=0;i<N;i++) { if(viz[i]==0){ possible.pb(i); } } int ans=INF; for(ll i=0;i<v.size();i++) { ll res=1; move_inside(v[i]); vector<ll>remove; for(auto it : possible){ move_inside(it); ll x=press_button(); if(x>=2){ res++; remove.pb(it); } move_outside(it); } for(auto it : remove){ possible.erase(possible.find(it)); } move_outside(v[i]); ans=min(ans,res); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:15:16: error: 'class std::set<long long int>' has no member named 'push_back'
   15 |     #define pb push_back
      |                ^~~~~~~~~
insects.cpp:43:18: note: in expansion of macro 'pb'
   43 |         possible.pb(i);
      |                  ^~
insects.cpp:47:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(ll i=0;i<v.size();i++)
      |                ~^~~~~~~~~
insects.cpp:65:22: error: no matching function for call to 'min(int&, ll&)'
   65 |       ans=min(ans,res);
      |                      ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from insects.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
insects.cpp:65:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   65 |       ans=min(ans,res);
      |                      ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from insects.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
insects.cpp:65:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   65 |       ans=min(ans,res);
      |                      ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from insects.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
insects.cpp:65:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   65 |       ans=min(ans,res);
      |                      ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from insects.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
insects.cpp:65:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   65 |       ans=min(ans,res);
      |                      ^