제출 #565774

#제출 시각아이디문제언어결과실행 시간메모리
565774MrDebooEvacuation plan (IZhO18_plan)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define endl '\n' using namespace std; using namespace __gnu_pbds; using ordered_set = tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>; pair<unordered_map<int,bool>,vector<pair<int,int>>>pr[100001];//have / need vector<int>need[100001]; vector<pair<int,int>>vcc; map<pair<int,int>,int>ans; int fath[100001]; int cur=0; void merge(int a,int b){ if(pr[a].second>pr[b].second)swap(pr[a],pr[b]); for(auto &i:pr[a].second){ if(pr[b].first[i.first]){ if(!ans.count({min(i.second,i.first),max(i.first,i.second)}))ans[{min(i.second,i.first),max(i.first,i.second)}]=cur; } } while(pr[a].second.size()){ pr[b].second.push_back(pr[a].second.back()); pr[a].second.pop_back(); } if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first); for(auto &i:pr[a].first)pr[b].first[i.first]=1; pr[a].first.clear(); } int dsu(int a){ if(fath[a]==a)return a; int k=dsu(fath[a]); merge(a,k); return fath[a]=k; } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n,m; cin>>n>>m; for(int i=1;i<=n;i++)fath[i]=i; vector<pair<int,int>>vct[n+1]; while(m--){ int u,v,w; cin>>u>>v>>w; vct[u].push_back({v,w}); vct[v].push_back({u,w}); } vector<int>dan(n+1,-1); priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pq; int k; cin>>k; while(k--){ int x; cin>>x; pq.push({0,x}); } while(pq.size()){ int b=pq.top().first,a=pq.top().second; pq.pop(); if(dan[a]!=-1)continue; dan[a]=b; for(auto &i:vct[a]){ if(dan[i.first]==-1){ pq.push({b+i.second,i.first}); } } } vector<pair<int,int>>vec; for(int i=1;i<=n;i++)vec.push_back({dan[i],i}); sort(vec.begin(),vec.end(),greater<pair<int,int>>()); int q; cin>>q; while(q--){ int u,v; cin>>u>>v; vcc.push_back({u,v}); need[u].push_back(v); need[v].push_back(u); } for(int i=1;i<=n;i++){ pr[i].first[i]=1; for(auto &w:need[i])pr[i].second.push_back({w,i}); } for(int i=0;i<n;i++){ cur=vec[i].first; // cout<<cur<<' '; for(auto &w:vct[vec[i].second]){ if(dan[w.first]<vec[i].first)continue; fath[dsu(vec[i].second)]=fath[dsu(w.first)]; dsu(fath[dsu(vec[i].second)]); } } for(auto &i:vcc)cout<<ans[{min(i.first,i.second),max(i.first,i.second)}]<<endl; } /* 9 12 1 9 4 1 2 5 2 3 7 2 4 3 4 3 6 3 6 4 8 7 10 6 7 5 5 8 1 9 5 7 5 4 12 6 8 2 2 4 7 5 1 6 5 3 4 8 5 8 1 5 */

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

plan.cpp: In function 'void merge(long long int, long long int)':
plan.cpp:26:19: error: no match for 'operator>' (operand types are 'std::unordered_map<long long int, bool>' and 'std::unordered_map<long long int, bool>')
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |        ~~~~~~~~~~~^~~~~~~~~~~~
      |              |           |
      |              |           unordered_map<[...],[...]>
      |              unordered_map<[...],[...]>
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from plan.cpp:1:
/usr/include/c++/10/bits/regex.h:1108:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)'
 1108 |     operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1108:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from plan.cpp:1:
/usr/include/c++/10/bits/regex.h:1168:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)'
 1168 |     operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1168:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from plan.cpp:1:
/usr/include/c++/10/bits/regex.h:1261:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1261 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1261:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from plan.cpp:1:
/usr/include/c++/10/bits/regex.h:1335:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)'
 1335 |     operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1335:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from plan.cpp:1:
/usr/include/c++/10/bits/regex.h:1429:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1429 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1429:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from plan.cpp:1:
/usr/include/c++/10/bits/regex.h:1505:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)'
 1505 |     operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1505:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from plan.cpp:1:
/usr/include/c++/10/bits/regex.h:1605:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1605 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1605:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 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 plan.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:502:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  502 |     operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:502:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::pair<_T1, _T2>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 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 plan.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:378:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  378 |     operator>(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:378:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::reverse_iterator<_Iterator>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 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 plan.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:416:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  416 |     operator>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:416:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::reverse_iterator<_Iterator>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 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 plan.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1469:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1469 |     operator>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1469:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::move_iterator<_IteratorL>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 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 plan.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1519:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1519 |     operator>(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1519:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::move_iterator<_IteratorL>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from plan.cpp:1:
/usr/include/c++/10/string_view:563:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
  563 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:563:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from plan.cpp:1:
/usr/include/c++/10/string_view:569:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >)'
  569 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:569:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from plan.cpp:1:
/usr/include/c++/10/string_view:576:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)'
  576 |     operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:576:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from plan.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6305:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6305 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6305:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from plan.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6318:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6318 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6318:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   'std::unordered_map<long long int, bool>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from plan.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6330:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6330 |     operator>(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6330:5: note:   template argument deduction/substitution failed:
plan.cpp:26:26: note:   mismatched types 'const _CharT*' and 'std::unordered_map<long long int, bool>'
   26 |     if(pr[a].first>pr[b].first)swap(pr[a].first,pr[b].first);
      |                          ^~~~~
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from plan.cpp:1:
/usr/include/c++/10/array:293:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bo