# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1011378 | Double_Slash | Languages (IOI10_languages) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
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) {
(*this)[k] += v;
}
tot += o.tot;
while (size() > MAX) {
tot -= begin()->second;
erase(begin());
}
}};
struct Profile {
Data<pint> doub;
Profile() {}
Profile(int *arr) {
for (int i = 0; i < 100; ++i) {
if (i) doub[{arr[i - 1], arr[i]}]++;
}
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;
}
컴파일 시 표준 에러 (stderr) 메시지
lang.cpp: In member function 'void Data<T>::operator+=(const Data<T>&)': lang.cpp:35:19: error: no matching function for call to 'size()' 35 | while (size() > MAX) { | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:245:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 245 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ /usr/include/c++/10/bits/range_access.h:245:5: note: template argument deduction/substitution failed: lang.cpp:35:19: note: candidate expects 1 argument, 0 provided 35 | while (size() > MAX) { | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:254:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 254 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/10/bits/range_access.h:254:5: note: template argument deduction/substitution failed: lang.cpp:35:19: note: candidate expects 1 argument, 0 provided 35 | while (size() > MAX) { | ^ lang.cpp:36:24: error: no matching function for call to 'begin()' 36 | tot -= begin()->second; | ^ In file included from /usr/include/c++/10/bits/range_access.h:36, from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/initializer_list:90:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)' 90 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/10/initializer_list:90:5: note: template argument deduction/substitution failed: lang.cpp:36:24: note: candidate expects 1 argument, 0 provided 36 | tot -= begin()->second; | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:51:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 51 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/10/bits/range_access.h:51:5: note: template argument deduction/substitution failed: lang.cpp:36:24: note: candidate expects 1 argument, 0 provided 36 | tot -= begin()->second; | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:61:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 61 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/10/bits/range_access.h:61:5: note: template argument deduction/substitution failed: lang.cpp:36:24: note: candidate expects 1 argument, 0 provided 36 | tot -= begin()->second; | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:90:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])' 90 | begin(_Tp (&__arr)[_Nm]) | ^~~~~ /usr/include/c++/10/bits/range_access.h:90:5: note: template argument deduction/substitution failed: lang.cpp:36:24: note: candidate expects 1 argument, 0 provided 36 | tot -= begin()->second; | ^ 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:1214:5: note: candidate: 'template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&)' 1214 | begin(valarray<_Tp>& __va) | ^~~~~ /usr/include/c++/10/valarray:1214:5: note: template argument deduction/substitution failed: lang.cpp:36:24: note: candidate expects 1 argument, 0 provided 36 | tot -= begin()->second; | ^ 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:1224:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&)' 1224 | begin(const valarray<_Tp>& __va) | ^~~~~ /usr/include/c++/10/valarray:1224:5: note: template argument deduction/substitution failed: lang.cpp:36:24: note: candidate expects 1 argument, 0 provided 36 | tot -= begin()->second; | ^ lang.cpp:37:23: error: no matching function for call to 'begin()' 37 | erase(begin()); | ^ In file included from /usr/include/c++/10/bits/range_access.h:36, from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/initializer_list:90:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)' 90 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/10/initializer_list:90:5: note: template argument deduction/substitution failed: lang.cpp:37:23: note: candidate expects 1 argument, 0 provided 37 | erase(begin()); | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:51:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 51 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/10/bits/range_access.h:51:5: note: template argument deduction/substitution failed: lang.cpp:37:23: note: candidate expects 1 argument, 0 provided 37 | erase(begin()); | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:61:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 61 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/10/bits/range_access.h:61:5: note: template argument deduction/substitution failed: lang.cpp:37:23: note: candidate expects 1 argument, 0 provided 37 | erase(begin()); | ^ In file included from /usr/include/c++/10/string:54, 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 lang.cpp:3: /usr/include/c++/10/bits/range_access.h:90:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])' 90 | begin(_Tp (&__arr)[_Nm]) | ^~~~~ /usr/include/c++/10/bits/range_access.h:90:5: note: template argument deduction/substitution failed: lang.cpp:37:23: note: candidate expects 1 argument, 0 provided 37 | erase(begin()); | ^ 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:1214:5: note: candidate: 'template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&)' 1214 | begin(valarray<_Tp>& __va) | ^~~~~ /usr/include/c++/10/valarray:1214:5: note: template argument deduction/substitution failed: lang.cpp:37:23: note: candidate expects 1 argument, 0 provided 37 | erase(begin()); | ^ 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:1224:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&)' 1224 | begin(const valarray<_Tp>& __va) | ^~~~~ /usr/include/c++/10/valarray:1224:5: note: template argument deduction/substitution failed: lang.cpp:37:23: note: candidate expects 1 argument, 0 provided 37 | erase(begin()); | ^ lang.cpp:37:11: error: there are no arguments to 'erase' that depend on a template parameter, so a declaration of 'erase' must be available [-fpermissive] 37 | erase(begin()); | ^~~~~ lang.cpp:37:11: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) lang.cpp: In instantiation of 'void Data<T>::operator+=(const Data<T>&) [with T = std::pair<int, int>]': lang.cpp:58:17: required from here lang.cpp:37:24: error: 'erase' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] 37 | erase(begin()); | ^ lang.cpp:37:24: note: declarations in dependent base 'std::map<std::pair<int, int>, int, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >' are not found by unqualified lookup lang.cpp:37:24: note: use 'this->erase' instead