# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115346 | 2019-06-06 18:12:03 | model_code | Matching (CEOI11_mat) | 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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Veryfing solution for the task MAT (Matching)
* Author: Jakub Radoszewski
* Date: July 2011
* Time complexity: O(nlogn + m)
*/
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
#define MAX 1000000
#define INFTY 100000000
/* p1 is the original pattern from the problem statement, while
* p is given from left to right, like the text t. */
int n, m;
int p1[MAX + 1], p[MAX + 1], t[MAX + 1];
void read()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
cin >> p1[i];
}
for (int i = 1; i <= n; i++)
p[p1[i]] = i;
for (int i = 1; i <= m; i++)
cin >> t[i];
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Compilation message (stderr)
mat.cpp: In function 'void init_trees()': mat.cpp:40:3: error: reference to 'size' is ambiguous size = 1; ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~ mat.cpp:41:10: error: reference to 'size' is ambiguous while (size <= n) ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~ mat.cpp:42:5: error: reference to 'size' is ambiguous size *= 2; ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~ mat.cpp:43:28: error: reference to 'size' is ambiguous for (int i = 0; i <= 2 * size - 1; i++) ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~ mat.cpp: In function 'int max_query(int)': mat.cpp:52:13: error: reference to 'size' is ambiguous int ind = size + v; ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~ mat.cpp: In function 'int min_query(int)': mat.cpp:65:13: error: reference to 'size' is ambiguous int ind = size + v; ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~ mat.cpp: In function 'void min_insert(std::pair<int, int>)': mat.cpp:78:13: error: reference to 'size' is ambiguous int ind = size + p.first; ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~ mat.cpp: In function 'void max_insert(std::pair<int, int>)': mat.cpp:90:13: error: reference to 'size' is ambiguous int ind = size + p.first; ^~~~ mat.cpp:36:5: note: candidates are: int size int size; ^~~~ In file included from /usr/include/c++/7/string:51:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from mat.cpp:7: /usr/include/c++/7/bits/range_access.h:252:5: note: template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm]) size(const _Tp (&/*__array*/)[_Nm]) noexcept ^~~~ /usr/include/c++/7/bits/range_access.h:242:5: note: template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&) size(const _Container& __cont) noexcept(noexcept(__cont.size())) ^~~~