Submission #341847

# Submission time Handle Problem Language Result Execution time Memory
341847 2020-12-31T08:19:47 Z ronnith Secret (JOI14_secret) C++14
0 / 100
511 ms 4588 KB
#include <bits/stdc++.h>
#include "secret.h"

#define FOR(i,a,b) for(int i = (a);i < (b);i ++)
#define ROF(i,a,b) for(int i = (a);i >= (b);i --)
#define trav(a, b) for(auto a : b)
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()

#define pb push_back
#define mk make_pair
#define f first
#define s second

using namespace std;

typedef long long ll;

int n;
int dat[11][1000];

void divi(int lvl, int lx, int rx, int *a){
	if(lx == rx){
		dat[lvl][lx] = a[lx];
		return;
	}
	int mid = lx + (rx - lx) / 2;
	ROF(i,mid,lx){
		if(i == mid)dat[lvl][i] = a[i];
		else dat[lvl][i] = Secret(a[i], dat[lvl][i + 1]);
	}
	FOR(i,mid + 1,rx + 1){
		if(i == mid + 1)dat[lvl][i] = a[i];
		else dat[lvl][i] = Secret(a[i], dat[lvl][i - 1]);
	}
	divi(lvl + 1, lx, mid, a);divi(lvl + 1, mid + 1, rx, a);
}

void Init(int N, int a[]) {
	n = N;
	divi(0,0,n - 1,a);
}

int query(int lvl, int l, int r, int lx, int rx){
	int mid = lx + (rx - lx) / 2;
	if(r >= mid && l <= mid){
		int res = dat[lvl][l];
		if(r > mid)res = Secret(res, dat[lvl][r]);
		return res;
	}
	if(r < mid)return query(lvl + 1, l, r, lx, mid);
	else return query(lvl + 1, l, r, mid + 1, rx);
}

int Query(int l, int r) {
	return query(0,l,r,0,n - 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 2540 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 131 ms 2540 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 136 ms 2668 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 511 ms 4588 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 498 ms 4500 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 502 ms 4460 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 494 ms 4460 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 496 ms 4460 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 494 ms 4460 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 497 ms 4460 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.