Submission #243248

# Submission time Handle Problem Language Result Execution time Memory
243248 2020-06-30T15:54:11 Z Rainbowbunny Secret (JOI14_secret) C++17
0 / 100
524 ms 4472 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 Get(l, r, 0, 0, n - 1);
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 138 ms 2424 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805455092.
2 Incorrect 135 ms 2424 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 534774241.
3 Incorrect 138 ms 2424 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 204699730.
4 Incorrect 524 ms 4320 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 273285253.
5 Incorrect 494 ms 4472 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 509231116.
6 Incorrect 501 ms 4344 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 589877417.
7 Incorrect 504 ms 4344 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 9155594.
8 Incorrect 518 ms 4472 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 828815616.
9 Incorrect 499 ms 4344 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 700983590.
10 Incorrect 510 ms 4472 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 813517315.