답안 #243247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
243247 2020-06-30T15:53:33 Z Rainbowbunny 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
 
typedef pair <int, int> pii;
 
const int Inf = 2e9;
const int mod = 998244353;
const double Pi = acos(-1);
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n;
int A[1005];
int Table[10][1005];

void Build(int h, int l, int r)
{
	if(r - l <= 2)
	{
		return;
	}
	int mid = (l + r) >> 1;
	Table[h][mid] = A[mid];
	Table[h][mid - 1] = A[mid - 1];
	for(int i = mid + 1; i <= r; i++)
	{
		Table[h][i] = Secret(Table[h][i - 1], A[i]);
	}
	for(int i = mid - 1; i >= l; i--)
	{
		Table[h][i] = Secret(A[i], Table[h][i + 1]);
	}
	Build(h + 1, l, mid - 1);
	Build(h + 1, mid, r);
}

int Get(int l, int r, int h, int L, int R)
{
	int mid = (L + R) >> 1;
	if(r < mid)
	{
		return Get(l, r, h + 1, L, mid - 1);
	}
	if(l > mid)
	{
		return Get(l, r, h + 1, mid, R);
	}
	return Secret(Table[h][l], Table[h][r]);
}

void Init(int N, int b[])
{
	n = N;
	for(int i = 0; i < n; i++)
	{
		A[i] = b[i];
	}
	Build(0, 0, n - 1);
}

int Query(int l, int r)
{
	if(r == l)
	{
		return A[l];
	}
	else if(r - l == 1)
	{
		return Secret(A[l], A[l + 1]);
	}
	else
	{
		return find(l, r, 0, 0, n - 1);
	}
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:84:32: error: no matching function for call to 'find(int&, int&, int, int, int)'
   return find(l, r, 0, 0, n - 1);
                                ^
In file included from /usr/include/c++/7/bits/locale_facets.h:48:0,
                 from /usr/include/c++/7/bits/basic_ios.h:37,
                 from /usr/include/c++/7/ios:44,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from secret.cpp:1:
/usr/include/c++/7/bits/streambuf_iterator.h:369:5: note: candidate: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)
     find(istreambuf_iterator<_CharT> __first,
     ^~~~
/usr/include/c++/7/bits/streambuf_iterator.h:369:5: note:   template argument deduction/substitution failed:
secret.cpp:84:32: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int'
   return find(l, r, 0, 0, n - 1);
                                ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from secret.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3899:5: note: candidate: template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)
     find(_InputIterator __first, _InputIterator __last,
     ^~~~
/usr/include/c++/7/bits/stl_algo.h:3899:5: note:   template argument deduction/substitution failed:
secret.cpp:84:32: note:   candidate expects 3 arguments, 5 provided
   return find(l, r, 0, 0, n - 1);
                                ^