# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1011397 | 2024-06-30T13:07:08 Z | Double_Slash | Languages (IOI10_languages) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include "lang.h" #include "grader.h" #include <bits/stdc++.h> using namespace std; #define debug(x) [&] { auto _x = x; cerr << __LINE__ << ": " << #x << " = " << _x << endl; return _x; }() using pint = pair<int, int>; const int MAX = 100; double magic(double x) { return pow(abs(x), 1.2); } template <typename T> struct Data : map<T, int> { int tot = 0; set<pair<int, T>> inv; double operator&(const Data<T> &o) const { double ret = 0; for (auto [k, v]: *this) { ret += magic((double) v / tot - (o.count(k) ? (double) o.at(k) / o.tot : 0)); } for (auto [k, v]: o) { if (not this->count(k)) ret += magic((double) v / o.tot); } return ret; } void operator+=(const Data<T> &o) { for (auto &[k, v]: o) { pair<int, T> p{v, (*this)[k]}; inv.erase(p); inv.emplace(v, (*this)[k] += v); } tot += o.tot; while (inv.size() > MAX) { tot -= inv.begin()->first; this->erase(inv.begin()->second); } }}; struct Profile { Data<pint> doub; Profile() {} Profile(int *arr) { for (int i = 0; i < 100; ++i) { if (i) doub[{arr[i - 1], arr[i]}]++; } for (auto [k, v]: doub) doub.inv.emplace(v, k); doub.tot = 99; } double operator&(const Profile &o) const { return (doub & o.doub); } void operator+=(const Profile &o) { doub += o.doub; } } profile[56]; void excerpt(int *E) { Profile p(E); pair<double, int> mn{1e18, 0}; for (int i = 0; i < 56; ++i) { mn = min(mn, {p & profile[i], i}); } int ans = language(mn.second); profile[ans] += p; }
Compilation message
lang.cpp: In instantiation of 'void Data<T>::operator+=(const Data<T>&) [with T = std::pair<int, int>]': lang.cpp:62:17: required from here lang.cpp:33:24: error: no matching function for call to 'std::pair<int, std::pair<int, int> >::pair(<brace-enclosed initializer list>)' 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:452:9: note: candidate: 'template<class ... _Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int ..._Indexes2> std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {_Args1 ...}; long unsigned int ..._Indexes1 = {_Indexes1 ...}; _Args2 = {_Args2 ...}; long unsigned int ..._Indexes2 = {_Indexes2 ...}; _T1 = int; _T2 = std::pair<int, int>]' 452 | pair(tuple<_Args1...>&, tuple<_Args2...>&, | ^~~~ /usr/include/c++/10/bits/stl_pair.h:452:9: note: template argument deduction/substitution failed: lang.cpp:33:24: note: mismatched types 'std::tuple<_Tps ...>' and 'std::tuple_element<1, const std::pair<const std::pair<int, int>, int> >::type' {aka 'const int'} 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:387:9: note: candidate: 'template<class ... _Args1, class ... _Args2> std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {_Args1 ...}; _Args2 = {_Args2 ...}; _T1 = int; _T2 = std::pair<int, int>]' 387 | pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); | ^~~~ /usr/include/c++/10/bits/stl_pair.h:387:9: note: template argument deduction/substitution failed: lang.cpp:33:24: note: mismatched types 'std::tuple<_Tps ...>' and 'int' 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:381:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 381 | explicit constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:381:21: note: template argument deduction/substitution failed: lang.cpp:33:24: note: mismatched types 'std::pair<_T1, _T2>' and 'std::tuple_element<1, const std::pair<const std::pair<int, int>, int> >::type' {aka 'const int'} 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:371:12: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 371 | constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:371:12: note: template argument deduction/substitution failed: lang.cpp:33:24: note: mismatched types 'std::pair<_T1, _T2>' and 'std::tuple_element<1, const std::pair<const std::pair<int, int>, int> >::type' {aka 'const int'} 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:361:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 361 | explicit constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:361:21: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:360:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 360 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:352:12: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 352 | constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:352:12: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:351:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 351 | bool>::type=true> | ^~~~ /usr/include/c++/10/bits/stl_pair.h:343:17: note: candidate: 'template<class _U2, typename std::enable_if<_CopyMovePair<false, int, _U2>(), bool>::type <anonymous> > std::pair<_T1, _T2>::pair(const _T1&, _U2&&) [with _U2 = _U2; typename std::enable_if<std::_PCC<true, _T1, _T2>::_CopyMovePair<false, _T1, _U2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 343 | explicit pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:343:17: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:342:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 342 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:336:18: note: candidate: 'template<class _U2, typename std::enable_if<_CopyMovePair<true, int, _U2>(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, _U2&&) [with _U2 = _U2; typename std::enable_if<std::_PCC<true, _T1, _T2>::_CopyMovePair<true, _T1, _U2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 336 | constexpr pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:336:18: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:335:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 335 | bool>::type=true> | ^~~~ /usr/include/c++/10/bits/stl_pair.h:329:27: note: candidate: 'template<class _U1, typename std::enable_if<_MoveCopyPair<false, _U1, std::pair<int, int> >(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&) [with _U1 = _U1; typename std::enable_if<std::_PCC<true, _T1, _T2>::_MoveCopyPair<false, _U1, _T2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 329 | explicit constexpr pair(_U1&& __x, const _T2& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:329:27: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:328:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 328 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:322:18: note: candidate: 'template<class _U1, typename std::enable_if<_MoveCopyPair<true, _U1, std::pair<int, int> >(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&) [with _U1 = _U1; typename std::enable_if<std::_PCC<true, _T1, _T2>::_MoveCopyPair<true, _U1, _T2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 322 | constexpr pair(_U1&& __x, const _T2& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:322:18: note: template argument deduction/substitution failed: lang.cpp:33:24: note: cannot convert '((Data<std::pair<int, int> >*)this)->Data<std::pair<int, int> >::<anonymous>.std::map<std::pair<int, int>, int, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >::operator[]((* & k))' (type 'std::map<std::pair<int, int>, int, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >::mapped_type' {aka 'int'}) to type 'const std::pair<int, int>&' 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:315:17: note: candidate: 'constexpr std::pair<_T1, _T2>::pair(std::pair<_T1, _T2>&&) [with _T1 = int; _T2 = std::pair<int, int>]' 315 | constexpr pair(pair&&) = default; ///< Move constructor | ^~~~ /usr/include/c++/10/bits/stl_pair.h:315:17: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_pair.h:314:17: note: candidate: 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = int; _T2 = std::pair<int, int>]' 314 | constexpr pair(const pair&) = default; ///< Copy constructor | ^~~~ /usr/include/c++/10/bits/stl_pair.h:314:17: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_pair.h:309:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 309 | explicit constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:309:21: note: template argument deduction/substitution failed: lang.cpp:33:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'std::tuple_element<1, const std::pair<const std::pair<int, int>, int> >::type' {aka 'const int'} 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:300:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 300 | constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:300:19: note: template argument deduction/substitution failed: lang.cpp:33:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'std::tuple_element<1, const std::pair<const std::pair<int, int>, int> >::type' {aka 'const int'} 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:276:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_ConstructiblePair<_U1, _U2>() && (! _ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 276 | explicit constexpr pair(const _T1& __a, const _T2& __b) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:276:26: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:275:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 275 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:266:17: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_ConstructiblePair<_U1, _U2>() && _ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 266 | constexpr pair(const _T1& __a, const _T2& __b) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:266:17: note: template argument deduction/substitution failed: lang.cpp:33:24: note: cannot convert '((Data<std::pair<int, int> >*)this)->Data<std::pair<int, int> >::<anonymous>.std::map<std::pair<int, int>, int, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >::operator[]((* & k))' (type 'std::map<std::pair<int, int>, int, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >::mapped_type' {aka 'int'}) to type 'const std::pair<int, int>&' 33 | pair<int, T> p{v, (*this)[k]}; | ^ 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 lang.cpp:3: /usr/include/c++/10/bits/stl_pair.h:245:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<std::__and_<std::is_default_constructible<_U1>, std::is_default_constructible<_U2>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair() [with _U1 = _U1; _U2 = _U2; typename std::enable_if<std::__and_<std::is_default_constructible<_U1>, std::is_default_constructible<_U2>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = std::pair<int, int>]' 245 | explicit constexpr pair() |