# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235616 | Blagojce | Secret (JOI14_secret) | C++11 | 601 ms | 4628 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
#include <time.h>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ll inf = 1e18;
const ll mod = 1000000007;
const ld eps = 1e-13;
const ld pi = 3.14159265359;
mt19937 _rand(time(NULL));
clock_t timer = clock();
const int mxn = 5e5 + 5;
#include "secret.h"
int seg[10000];
int n;
int a[1001];
void build(int k, int l, int r){
if(l == r){
seg[k] = a[l];
return;
}
int mid = (l + r) / 2;
build(k * 2, l, mid);
build(k * 2 + 1, mid + 1, r);
seg[k] = Secret(seg[k * 2], seg[k * 2 + 1]);
}
vector<int> v;
void query(int k, int l, int r, int x, int y){
if(y < l || r < x) return;
if(x <= l && r <= y){
v.pb(seg[k]);
return;
}
int mid = (l + r) / 2;
query(k * 2, l, mid, x, y);
query(k * 2 + 1, mid + 1, r, x, y);
}
void Init(int N, int A[]) {
n = N;
fr(i, 0, N){
a[i] = A[i];
}
build(1, 0, n-1);
}
int Query(int L, int R){
v.clear();
query(1, 0, n - 1, L, R);
int ans = v[0];
fr(i, 1, (int)v.size()){
ans = Secret(ans, v[i]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |