Submission #376666

# Submission time Handle Problem Language Result Execution time Memory
376666 2021-03-12T00:30:04 Z Leonardo_Paes Secret (JOI14_secret) C++17
0 / 100
537 ms 4856 KB
#include "secret.h"
#include <bits/stdc++.h>

typedef std::pair<int,int> pii;
#define f first
#define s second
const int maxn = 1030;
int v[maxn], n;

class Seg{
public:
	void build(int node, int l, int r){
		if(l == r){
			pref[node].push_back(v[l]);
			return;
		}
		int mid = (l + r) >> 1;
		int val;
		for(int i=mid; i>=l; i--){
			if(i == mid) suf[node].push_back(val = v[i]);
			else suf[node].push_back(val = Secret(v[i], val));
		}
		for(int i=mid+1; i<=r; i++){
			if(i == mid+1) pref[node].push_back(val = v[i]);
			else pref[node].push_back(val = Secret(val, v[i]));
		}
		build(2*node, l, mid), build(2*node+1, mid+1, r);
	}
	int query(int node, int tl, int tr, int l, int r){
		int mid = (tl + tr) >> 1;
		if(tl == tr) return pref[node].front();
		if(l <= mid and mid <= r) 
			return Secret(suf[node][mid - l], pref[node][r - mid - 1]);
		else if(l >= mid) return query(2*node+1, mid+1, tr, l, r);
		else return query(2*node, tl, mid, l, r);
	}
private:
	std::vector<int> pref[2*maxn], suf[2*maxn];
}seg;

void Init(int N, int A[]) {
	n = N;
	for(int i=1; i<=N; i++) v[i] = A[i-1];
	seg.build(1, 1, n);
}

int Query(int L, int R) {
	L++, R++;
	return seg.query(1, 1, n, L, R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 134 ms 2756 KB Wrong Answer: Query(264, 271) - expected : 675707686, actual : 4619042.
2 Incorrect 137 ms 2668 KB Wrong Answer: Query(210, 211) - expected : 558550312, actual : 558532904.
3 Incorrect 155 ms 2668 KB Wrong Answer: Query(64, 128) - expected : 469502, actual : 537340286.
4 Incorrect 495 ms 4588 KB Wrong Answer: Query(571, 624) - expected : 309502044, actual : 309493852.
5 Incorrect 511 ms 4856 KB Wrong Answer: Query(876, 890) - expected : 899551822, actual : 362418254.
6 Incorrect 507 ms 4588 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 278446241.
7 Correct 537 ms 4584 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 531 ms 4588 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 517 ms 4588 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 533 ms 4844 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1