Submission #831074

# Submission time Handle Problem Language Result Execution time Memory
831074 2023-08-19T16:58:52 Z starchan Secret (JOI14_secret) C++17
0 / 100
349 ms 4364 KB
#include<bits/stdc++.h>
#include "secret.h"
using namespace std;
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)5e3+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
int XXX;
int secret(int x, int y)
{
	if(min(x, y) == -1)
		return x+y+1;
	else
		return Secret(x, y);
}
struct segment_tree
{
	vector<int> tree;
	void build(const int a[], int id, int l, int r)
	{
		int m = (l+r)/2;
		if(l==r)
		{
			tree[m] = a[id];
			return;
		}
		build(a, 2*id, l, m);
		build(a, 2*id+1, m+1, r);
		tree[id] = secret(tree[2*id], tree[2*id+1]);
		return;
	}
	void init(int n, const int a[])
	{
		tree.resize(MX);
		build(a, 1, 0, n-1);
		return;
	}	
	int query(int ql, int qr, int id, int l, int r)
	{
		if(qr < l || r < ql)
			return -1;
		if(ql <= l && r <= qr)
			return tree[id];
		int m = (l+r)/2;
		int x = query(ql, qr, 2*id, l, m);
		int y = query(ql, qr, 2*id+1, m+1, r);
		return secret(x, y);
	}
};
segment_tree work;
void Init(int n, int a[])
{
	work.init(n, a);
	XXX = n;
	return;
}
int Query(int l, int r)
{
	return work.query(l, r, 1, 0, XXX-1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 2456 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 93 ms 2392 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 92 ms 2420 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 344 ms 4300 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 343 ms 4300 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 346 ms 4364 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0.
7 Incorrect 344 ms 4312 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 349 ms 4276 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870976.
9 Incorrect 344 ms 4300 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 811480943.
10 Incorrect 349 ms 4348 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 607371779.