Submission #935443

#TimeUsernameProblemLanguageResultExecution timeMemory
935443BaizhoSecret (JOI14_secret)C++14
30 / 100
429 ms4624 KiB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
  
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
 
// #pragma GCC optimize("Ofast,unroll-loops,fast-math")
// #pragma GCC target("popcnt")
 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
 
#define sz size()
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define pb push_back
 
const int mod = ll(1e9)+7;
const ll MOD = 998244353;
const long long inf = 5e18;
const int M = 1005;

int Secret(int x, int y);

int val[10][M], n, a[M];

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

int Query(int L, int R) {
	int l = L, r = R, siz = r - l + 1, res = -1;
	for(int j = 9; l <= r && j >= 0; j --) {
		if(siz & (1 << j)) {
			if(res == -1) res = val[j][l];
			else res = Secret(res, val[j][l]);
			l += (1 << j);
		}
	}
	return res;
}

Compilation message (stderr)

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:40:61: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   40 |    val[j][i] = Secret(val[j - 1][i], val[j - 1][i + (1 << j - 1)]);
      |                                                           ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...