Submission #373368

# Submission time Handle Problem Language Result Execution time Memory
373368 2021-03-04T10:14:03 Z wind_reaper Secret (JOI14_secret) C++17
0 / 100
512 ms 4528 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;

const int INF = 1e9;
const int MXN = 1000;

int st[10][MXN], mask[MXN], a[MXN], n;

void dnc(int l, int r, int lev){
	if(l == r)
		return;

	int mid = (l + r) >> 1;

	st[lev][mid] = a[mid];
	
	for(int i = mid-1; i >= l; --i)
		st[lev][i] = Secret(a[i], st[lev][i+1]);

	st[lev][mid+1] = a[mid+1];

	for(int i = mid+2; i <= r; i++)
		st[lev][i] = Secret(st[lev][i-1], a[i]);

	for(int i = mid + 1; i <= r; i++)
		mask[i] ^= (1 << lev);

	dnc(l, mid, lev+1), dnc(mid+1, r, lev+1);
}

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

int Query(int L, int R){
	int level = __builtin_ctz(mask[L]^mask[R]);
	return Secret(st[level][L], st[level][R]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 2412 KB Wrong Answer: Query(56, 56) - expected : 677274107, actual : 536870912.
2 Incorrect 132 ms 2412 KB Wrong Answer: Query(389, 389) - expected : 472506730, actual : 0.
3 Incorrect 144 ms 2540 KB Wrong Answer: Query(18, 18) - expected : 238214183, actual : 536870912.
4 Incorrect 504 ms 4332 KB Wrong Answer: Query(788, 788) - expected : 937598145, actual : 536870912.
5 Incorrect 494 ms 4332 KB Wrong Answer: Query(957, 957) - expected : 115761809, actual : 536870912.
6 Incorrect 496 ms 4332 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 536870912.
7 Correct 509 ms 4460 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 512 ms 4528 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 511 ms 4460 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 508 ms 4332 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1