제출 #362883

#제출 시각아이디문제언어결과실행 시간메모리
362883NimbostratusLottery (CEOI18_lot)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define eb emplace_back #define pb push_back #define ppb pop_back #define ub upper_bound #define lb lower_bound #define bs binary_search #define cl(a,s) memset((a),0,sizeof((a)[0])*(s)) #define all(x) (x).begin() , (x).end() #define fi first #define se second #define int int using pii = pair<int,int>; using ll = long long; const int maxn = 10005; const int maxq = 105; const int inf = 1e9; const int mod = 1e9+7; int n,a[maxn],l,q,k; int ans[maxn]; int cnt[maxn]; hash<vector<int>> hs; int32_t main () { //freopen("in","r",stdin); freopen("out","w",stdout); ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cin >> n >> l; for(int i=1;i<=n;i++) cin >> a[i]; cin >> q; for(int i=1;i<=q;i++) cin >> k; vector<int> vec(l); for(int i=1;i+l-1<=n;i++) { for(int j=i;j<=i+l-1;j++) vec[j-i] = a[j]; cnt[hs(vec)]++; } for(int i=1;i+l-1<=n;i++) { for(int j=i;j<=i+l-1;j++) vec[j-i] = a[j]; cout << cnt[hs(vec)] << " "; } }

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

lot.cpp:24:19: error: use of deleted function 'std::hash<std::vector<int> >::hash()'
   24 | hash<vector<int>> hs;
      |                   ^~
In file included from /usr/include/c++/9/bits/basic_string.h:6719,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from lot.cpp:1:
/usr/include/c++/9/bits/functional_hash.h:101:12: note: 'std::hash<std::vector<int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
  101 |     struct hash : __hash_enum<_Tp>
      |            ^~~~
/usr/include/c++/9/bits/functional_hash.h:101:12: error: no matching function for call to 'std::__hash_enum<std::vector<int>, false>::__hash_enum()'
/usr/include/c++/9/bits/functional_hash.h:82:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::vector<int>; bool <anonymous> = false]'
   82 |       __hash_enum(__hash_enum&&);
      |       ^~~~~~~~~~~
/usr/include/c++/9/bits/functional_hash.h:82:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/9/bits/functional_hash.h:101:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::vector<int>; bool <anonymous> = false]' is private within this context
  101 |     struct hash : __hash_enum<_Tp>
      |            ^~~~
/usr/include/c++/9/bits/functional_hash.h:83:7: note: declared private here
   83 |       ~__hash_enum();
      |       ^
lot.cpp: In function 'int32_t main()':
lot.cpp:37:13: error: no match for call to '(std::hash<std::vector<int> >) (std::vector<int>&)'
   37 |   cnt[hs(vec)]++;
      |             ^
lot.cpp:41:21: error: no match for call to '(std::hash<std::vector<int> >) (std::vector<int>&)'
   41 |   cout << cnt[hs(vec)] << " ";
      |                     ^
lot.cpp: In function 'void __static_initialization_and_destruction_0(int, int)':
lot.cpp:24:19: error: use of deleted function 'std::hash<std::vector<int> >::~hash()'
   24 | hash<vector<int>> hs;
      |                   ^~
In file included from /usr/include/c++/9/bits/basic_string.h:6719,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from lot.cpp:1:
/usr/include/c++/9/bits/functional_hash.h:101:12: note: 'std::hash<std::vector<int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
  101 |     struct hash : __hash_enum<_Tp>
      |            ^~~~
/usr/include/c++/9/bits/functional_hash.h:101:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::vector<int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/9/bits/functional_hash.h:83:7: note: declared private here
   83 |       ~__hash_enum();
      |       ^