Submission #831080

# Submission time Handle Problem Language Result Execution time Memory
831080 2023-08-19T17:04:36 Z starchan Secret (JOI14_secret) C++17
30 / 100
427 ms 4344 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(x == -1 || 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[id] = a[m];
			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 Partially correct 152 ms 2388 KB Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 13
2 Partially correct 145 ms 2312 KB Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14
3 Partially correct 136 ms 2348 KB Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 15
4 Partially correct 405 ms 4204 KB Output is partially correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 15
5 Partially correct 407 ms 4288 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15
6 Partially correct 357 ms 4288 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 4
7 Partially correct 427 ms 4296 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
8 Partially correct 409 ms 4172 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
9 Partially correct 411 ms 4344 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
10 Partially correct 413 ms 4236 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16