| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1011416 | Double_Slash | Languages (IOI10_languages) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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>;
double magic(double x) {
return pow(abs(x), 1.2);
}
template <typename T, int MAX>
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) {
inv.erase({(*this)[k], k});
inv.emplace((*this)[k] += v, k);
}
tot += o.tot;
while (inv.size() > MAX) {
tot -= inv.begin()->first;
this->erase(inv.begin()->second);
inv.erase(inv.begin());
}
}};
struct Profile {
Data<int, 50> sing;
Data<pint, 100> doub;
Profile() {}
Profile(int *arr) {
for (int i = 0; i < 100; ++i) {
sing[arr[i]]++;
if (i) doub[{arr[i - 1], arr[i]}]++;
}
for (auto [k, v]: doub) doub.inv.emplace(v, k);
sing.tot = 100;
doub.tot = 99;
}
double operator&(const Profile &o) const {
return (sing & o.sing) + (doub & o.doub);
}
void operator+=(const Profile &o) {
sing += o.sing;
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 (stderr)
lang.cpp:18:31: error: wrong number of template arguments (1, should be 2)
18 | double operator&(const Data<T> &o) const {
| ^
lang.cpp:14:8: note: provided for 'template<class T, int MAX> struct Data'
14 | struct Data : map<T, int> {
| ^~~~
lang.cpp:29:30: error: wrong number of template arguments (1, should be 2)
29 | void operator+=(const Data<T> &o) {
| ^
lang.cpp:14:8: note: provided for 'template<class T, int MAX> struct Data'
14 | struct Data : map<T, int> {
| ^~~~
lang.cpp: In member function 'double Data<T, MAX>::operator&(const int&) const':
lang.cpp:21:39: error: request for member 'count' in 'o', which is of non-class type 'const int'
21 | ret += magic((double) v / tot - (o.count(k) ? (double) o.at(k) / o.tot : 0));
| ^~~~~
lang.cpp:21:61: error: request for member 'at' in 'o', which is of non-class type 'const int'
21 | ret += magic((double) v / tot - (o.count(k) ? (double) o.at(k) / o.tot : 0));
| ^~
lang.cpp:21:71: error: request for member 'tot' in 'o', which is of non-class type 'const int'
21 | ret += magic((double) v / tot - (o.count(k) ? (double) o.at(k) / o.tot : 0));
| ^~~
lang.cpp:23:21: error: there are no arguments to 'begin' that depend on a template parameter, so a declaration of 'begin' must be available [-fpermissive]
23 | for (auto [k, v]: o) {
| ^
lang.cpp:23:21: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
lang.cpp:23:21: error: there are no arguments to 'end' that depend on a template parameter, so a declaration of 'end' must be available [-fpermissive]
lang.cpp:24:56: error: request for member 'tot' in 'o', which is of non-class type 'const int'
24 | if (not this->count(k)) ret += magic((double) v / o.tot);
| ^~~
lang.cpp: In member function 'void Data<T, MAX>::operator+=(const int&)':
lang.cpp:30:22: error: there are no arguments to 'begin' that depend on a template parameter, so a declaration of 'begin' must be available [-fpermissive]
30 | for (auto &[k, v]: o) {
| ^
lang.cpp:30:22: error: there are no arguments to 'end' that depend on a template parameter, so a declaration of 'end' must be available [-fpermissive]
lang.cpp:34:12: error: request for member 'tot' in 'o', which is of non-class type 'const int'
34 | tot += o.tot;
| ^~~
lang.cpp: In member function 'double Profile::operator&(const Profile&) const':
lang.cpp:59:16: error: no match for 'operator&' (operand types are 'const Data<int, 50>' and 'const Data<int, 50>')
59 | return (sing & o.sing) + (doub & o.doub);
| ~~~~ ^ ~~~~~~
| | |
| | Data<[...],[...]>
| Data<[...],[...]>
lang.cpp:18:9: note: candidate: 'double Data<T, MAX>::operator&(const int&) const [with T = int; int MAX = 50]'
18 | double operator&(const Data<T> &o) const {
| ^~~~~~~~
lang.cpp:18:34: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'const int&'
18 | double operator&(const Data<T> &o) const {
| ~~~~~~~~~~~~~~~^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
from lang.cpp:3:
/usr/include/c++/10/cstddef:138:3: note: candidate: 'constexpr std::byte std::operator&(std::byte, std::byte)'
138 | operator&(byte __l, byte __r) noexcept
| ^~~~~~~~
/usr/include/c++/10/cstddef:138:18: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'std::byte'
138 | operator&(byte __l, byte __r) noexcept
| ~~~~~^~~
In file included 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 lang.cpp:3:
/usr/include/c++/10/bits/ios_base.h:83:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(std::_Ios_Fmtflags, std::_Ios_Fmtflags)'
83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
| ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:83:27: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'std::_Ios_Fmtflags'
83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:125:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(std::_Ios_Openmode, std::_Ios_Openmode)'
125 | operator&(_Ios_Openmode __a, _Ios_Openmode __b)
| ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:125:27: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'std::_Ios_Openmode'
125 | operator&(_Ios_Openmode __a, _Ios_Openmode __b)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:165:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(std::_Ios_Iostate, std::_Ios_Iostate)'
165 | operator&(_Ios_Iostate __a, _Ios_Iostate __b)
| ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:165:26: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'std::_Ios_Iostate'
165 | operator&(_Ios_Iostate __a, _Ios_Iostate __b)
| ~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66,
from lang.cpp:3:
/usr/include/c++/10/bitset:1435:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const std::bitset<_Nb>&, const std::bitset<_Nb>&)'
1435 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/10/bitset:1435:5: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::bitset<_Nb>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/c++/10/bits/shared_ptr_atomic.h:33,
from /usr/include/c++/10/memory:85,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:82,
from lang.cpp:3:
/usr/include/c++/10/bits/atomic_base.h:100:3: note: candidate: 'constexpr std::memory_order std::operator&(std::memory_order, std::__memory_order_modifier)'
100 | operator&(memory_order __m, __memory_order_modifier __mod)
| ^~~~~~~~
/usr/include/c++/10/bits/atomic_base.h:100:26: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'std::memory_order'
100 | operator&(memory_order __m, __memory_order_modifier __mod)
| ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/c++/10/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/c++/10/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/c++/10/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/c++/10/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const std::valarray<_Tp>&, const std::valarray<_Tp>&)'
1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1191:1: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::valarray<_Tp>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)'
1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1191:1: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::valarray<_Tp>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
from lang.cpp:3:
/usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)'
1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1191:1: note: template argument deduction/substitution failed:
lang.cpp:59:20: note: 'const Data<int, 50>' is not derived from 'const std::valarray<_Tp>'
59 | return (sing & o.sing) + (doub & o.doub);
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
from lang.cpp:3:
/usr/include/c++/10/future:143:20: note: candidate: 'constexpr std::launch std::operator&(std::launch, std::launch)'
143 | constexpr launch operator&(launch __x, launch __y)
| ^~~~~~~~
/usr/include/c++/10/future:143:37: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'std::launch'
143 | constexpr launch operator&(launch __x, launch __y)
| ~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:127,
from lang.cpp:3:
/usr/include/c++/10/charconv:668:3: note: candidate: 'constexpr std::chars_format std::operator&(std::chars_format, std::chars_format)'
668 | operator&(chars_format __lhs, chars_format __rhs) noexcept
| ^~~~~~~~
/usr/include/c++/10/charconv:668:26: note: no known conversion for argument 1 from 'const Data<int, 50>' to 'std::chars_format'
668 | operator&(chars_format __lhs, chars_format __rhs) noexcept
| ~~~~~~~~~~~~~^~~~~
lang.cpp:59:34: error: no match for 'operator&' (operand types are 'const Data<std::pair<int, int>, 100>' and 'const Data<std::pair<int, int>, 100>')
59 | return (sing & o.sing) + (doub & o.doub);
| ~~~~ ^ ~~~~~~
| | |
| | Data<[...],[...]>
| Data<[...],[...]>
lang.cpp:18:9: note: candidate: 'double Data<T, MAX>::operator&(const int&) const [with T = std::pair<int, int>; int MAX = 100]'
18 | double operator&(const Data<T> &o) const {
| ^~~~~~~~
lang.cpp:18:34: note: no known conversion for argument 1 from 'const Data<std::pair<int, int>, 100>' to 'const int&'
18 | double operator&(const Data<T> &o) const {
| ~~~~~~~~~~~~~~~^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
from lang.cpp:3:
/usr/include/c++/10/cstddef:138:3: note: candidate: 'constexpr std::byte std::operator&(std::byte, std::byte)'
138 | operator&(byte __l, byte __r) noexcept
| ^~~~~~~~
/usr/include/c++/10/cstddef:138:18: note: no known conversion for argument 1 from 'const Data<std::pair<int, int>, 100>' to 'std::byte'
138 | operator&(byte __l, byte __r) noexcept
| ~~~~~^~~
In file included 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 lang.cpp:3:
/usr/include/c++/10/bits/ios_base.h:83:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(std::_Ios_Fmtflags, std::_Ios_Fmtflags)'
83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
| ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:83:27: note: no known conversion for argument 1 from 'const Data<std::pair<int, int>, 100>' to 'std::_Ios_Fmtflags'
83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:125:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(std::_Ios_Openmode, std::_Ios_Openmode)'
125 | operator&(_Ios_Openmode __a, _Ios_Openmode __b)
| ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:125:27: note: no known conversion for argument 1 from 'const Data<std::pair<int, int>, 100>' to 'std::_Ios_Openmode'
125 | operator&(_Ios_Openmode __a, _Ios_Openmode __b)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:165:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(std::_Ios_Iostate, std::_Ios_Iostate)'
165 | operator&(_Ios_Iostate __a, _Ios_Iostate __b)
| ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:165:26: note: no known conversion for argument 1 from 'co