Submission #291914

#TimeUsernameProblemLanguageResultExecution timeMemory
291914tatyamLanguages (IOI10_languages)C++17
Compilation error
0 ms0 KiB
#include "grader.h" #include "lang.h" #include <bits/stdc++.h> using namespace std; #define SZ 100 using i64 = int64_t; using u64 = uint64_t; int prev[1100000]; #define C(n) \ auto comp ## n = [](const array<int, n>& a){ u64 ans = 0; for(int i : a){ ans <<= 16; ans |= i; } return ans; };\ unordered_map<array<int, n>, array<i64, 56>, decltype(comp ## n)> c ## n(1 << 17, comp ## n) C(1); C(2); C(3); C(4); array<i64, 56> cnt; /* random_device RD; i64 A = 0, B = 28, C = 2085, D = 319620; double highest = 70.23; /*/ const int A = 0, B = 0, C = 5158, D = 541546; // */ void excerpt(int *E) { cnt.fill(0); for(int i = 0; i <= 100 - 1; i++){ auto& c = c1[{E[i]}]; for(int i = 0; i < 56; i++) cnt[i] += c[i]; } for(int i = 0; i <= 100 - 2; i++){ auto& c = c2[{E[i], E[i + 1]}]; for(int i = 0; i < 56; i++) cnt[i] += c[i]; } for(int i = 0; i <= 100 - 3; i++){ auto& c = c3[{E[i], E[i + 1], E[i + 2]}]; for(int i = 0; i < 56; i++) cnt[i] += c[i]; } for(int i = 0; i <= 100 - 4; i++){ auto& c = c4[{E[i], E[i + 1], E[i + 2], E[i + 3]}]; for(int i = 0; i < 56; i++) cnt[i] += c[i]; } int ans = language(max_element(cnt.begin(), cnt.end()) - cnt.begin()); for(int i = 0; i <= 100 - 1; i++){ auto& c = c1[{E[i]}]; c[ans] += A; } for(int i = 0; i <= 100 - 2; i++){ auto& c = c2[{E[i], E[i + 1]}]; c[ans] += B; } for(int i = 0; i <= 100 - 3; i++){ auto& c = c3[{E[i], E[i + 1], E[i + 2]}]; c[ans] += C; } for(int i = 0; i <= 100 - 4; i++){ auto& c = c4[{E[i], E[i + 1], E[i + 2], E[i + 3]}]; c[ans] += D; } } template<class T> bool chmax(T& a, const T& b){ if(a <= b){ a = b; return 1; } return 0; } int main(){ while(1){ c1.clear(); c2.clear(); c3.clear(); c4.clear(); i64 A2 = uniform_int_distribution<i64>(0, A * 2 + 2)(RD); i64 B2 = uniform_int_distribution<i64>(0, B * 2 + 2)(RD); i64 C2 = uniform_int_distribution<i64>(0, C * 2 + 2)(RD); i64 D2 = uniform_int_distribution<i64>(0, D * 2 + 2)(RD); swap(A, A2); swap(B, B2); swap(C, C2); swap(D, D2); if(chmax(highest, run())){ cout << A << ' ' << B << ' ' << C << ' ' << D << endl; } else{ swap(A, A2); swap(B, B2); swap(C, C2); swap(D, D2); } } }

Compilation message (stderr)

lang.cpp: In function 'int main()':
lang.cpp:74:60: error: 'RD' was not declared in this scope; did you mean 'D'?
   74 |       i64 A2 = uniform_int_distribution<i64>(0, A * 2 + 2)(RD);
      |                                                            ^~
      |                                                            D
lang.cpp:78:17: error: no matching function for call to 'swap(const int&, i64&)'
   78 |       swap(A, A2);
      |                 ^
In file included 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 lang.cpp:3:
/usr/include/c++/9/sstream:849:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&)'
  849 |     swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/9/sstream:849:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included 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 lang.cpp:3:
/usr/include/c++/9/sstream:856:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&)'
  856 |     swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/9/sstream:856:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included 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 lang.cpp:3:
/usr/include/c++/9/sstream:863:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&)'
  863 |     swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/9/sstream:863:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included 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 lang.cpp:3:
/usr/include/c++/9/sstream:870:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&)'
  870 |     swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/9/sstream:870:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from lang.cpp:3:
/usr/include/c++/9/bits/regex.h:844:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&)'
  844 |     swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
      |     ^~~~
/usr/include/c++/9/bits/regex.h:844:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from lang.cpp:3:
/usr/include/c++/9/bits/regex.h:2029:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(std::__cxx11::match_results<_BiIter, _Alloc>&, std::__cxx11::match_results<_BiIter, _Alloc>&)'
 2029 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/9/bits/regex.h:2029:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from lang.cpp:3:
/usr/include/c++/9/bits/move.h:182:5: note: candidate: 'template<class _Tp> typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&)'
  182 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/9/bits/move.h:182:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   deduced conflicting types for parameter '_Tp' ('const int' and 'i64' {aka 'long int'})
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from lang.cpp:3:
/usr/include/c++/9/bits/move.h:205:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> typename std::enable_if<std::__is_swappable<_Tp>::value>::type std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  205 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/9/bits/move.h:205:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types '_Tp [_Nm]' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from lang.cpp:3:
/usr/include/c++/9/bits/stl_pair.h:495:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)'
  495 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/9/bits/stl_pair.h:495:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::pair<_T1, _T2>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from lang.cpp:3:
/usr/include/c++/9/bits/stl_pair.h:503:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)' <deleted>
  503 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
/usr/include/c++/9/bits/stl_pair.h:503:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::pair<_T1, _T2>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included 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 lang.cpp:3:
/usr/include/c++/9/bits/basic_string.h:6378:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6378 |     swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/9/bits/basic_string.h:6378:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/array:294:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> typename std::enable_if<typename std::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type std::swap(std::array<_Tp, _Nm>&, std::array<_Tp, _Nm>&)'
  294 |     swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
      |     ^~~~
/usr/include/c++/9/array:294:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::array<_Tp, _Nm>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/array:302:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> typename std::enable_if<(! typename std::__array_traits<_Tp, _Nm>::_Is_swappable::value)>::type std::swap(std::array<_Tp, _Nm>&, std::array<_Tp, _Nm>&)' <deleted>
  302 |     swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete;
      |     ^~~~
/usr/include/c++/9/array:302:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::array<_Tp, _Nm>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/tuple:1624:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(std::tuple<_Tps ...>&, std::tuple<_Tps ...>&)'
 1624 |     swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
      |     ^~~~
/usr/include/c++/9/tuple:1624:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::tuple<_Tps ...>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/tuple:1631:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(std::tuple<_Tps ...>&, std::tuple<_Tps ...>&)' <deleted>
 1631 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
/usr/include/c++/9/tuple:1631:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::tuple<_Tps ...>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/functional:59,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/bits/std_function.h:785:5: note: candidate: 'template<class _Res, class ... _Args> void std::swap(std::function<_Res(_ArgTypes ...)>&, std::function<_Res(_ArgTypes ...)>&)'
  785 |     swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) noexcept
      |     ^~~~
/usr/include/c++/9/bits/std_function.h:785:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::function<_Res(_ArgTypes ...)>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/bits/node_handle.h:39,
                 from /usr/include/c++/9/bits/hashtable.h:37,
                 from /usr/include/c++/9/unordered_map:46,
                 from /usr/include/c++/9/functional:61,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/optional:1171:5: note: candidate: 'template<class _Tp> std::enable_if_t<(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>)> std::swap(std::optional<_Tp>&, std::optional<_Tp>&)'
 1171 |     swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs)
      |     ^~~~
/usr/include/c++/9/optional:1171:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::optional<_Tp>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/bits/node_handle.h:39,
                 from /usr/include/c++/9/bits/hashtable.h:37,
                 from /usr/include/c++/9/unordered_map:46,
                 from /usr/include/c++/9/functional:61,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/optional:1177:5: note: candidate: 'template<class _Tp> std::enable_if_t<(!(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>))> std::swap(std::optional<_Tp>&, std::optional<_Tp>&)' <deleted>
 1177 |     swap(optional<_Tp>&, optional<_Tp>&) = delete;
      |     ^~~~
/usr/include/c++/9/optional:1177:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::optional<_Tp>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/unordered_map:47,
                 from /usr/include/c++/9/functional:61,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/bits/unordered_map.h:2077:5: note: candidate: 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, std::unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&)'
 2077 |     swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/9/bits/unordered_map.h:2077:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/unordered_map:47,
                 from /usr/include/c++/9/functional:61,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/bits/unordered_map.h:2084:5: note: candidate: 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, std::unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&)'
 2084 |     swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/9/bits/unordered_map.h:2084:5: note:   template argument deduction/substitution failed:
lang.cpp:78:17: note:   mismatched types 'std::unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>' and 'const int'
   78 |       swap(A, A2);
      |                 ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from lang.cpp:3:
/usr/include/c++/9/bits/stl_vector.h:1936:5: note: candidate: 'template<class _Tp, class _Alloc> void std::swap(std::vector<_Tp, _Alloc>&, std::vector<_Tp, _Alloc>&)'
 1936 |     swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
      |     ^~~~
/usr/include/c++/9/bits/s