# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1094745 |
2024-09-30T12:47:38 Z |
asli_bg |
Secret (JOI14_secret) |
C++11 |
|
308 ms |
8644 KB |
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#include "secret.h"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define FOR(i,a) for(int i=0;i<(a);i++)
#define FORE(i,a,b) for(int i=(a);i<(b);i++)
#define cont(x) {for(auto el:x) cout<<el<<' ';cout<<endl;}
#define contp(x) {for(auto el:x) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl;}
#define sp <<" "<<
#define mid (l+r)/2
#define endl '\n'
#define DEBUG(X) {cout<<#X<<' '<<(X)<<endl;}
#define carp(x,y) ((x%MOD)*(y%MOD))%MOD
#define topla(x,y) ((x%MOD)+(y%MOD))%MOD
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;
const int MAXN=1e4+5;
const int MAXK=20;
vi a;
int n;
int tut[MAXK][MAXN];
int mask[MAXN];
void dq(int l,int r,int lev){
if(l>=r) return;
tut[lev][mid]=a[mid];
tut[lev][mid+1]=a[mid+1];
for(int i=mid-1;i>=l;i--){
tut[lev][i]=Secret(tut[lev][i+1],a[i]);
}
for(int i=mid+2;i<=r;i++){
tut[lev][i]=Secret(tut[lev][i-1],a[i]);
}
for(int i=mid+1;i<=r;i++) mask[i]=mask[i]^(1<<lev);
dq(l,mid,lev+1);
dq(mid+1,r,lev+1);
}
void Init(int N, int A[]) {
a.resize(N+1);
FOR(i,N) a[i+1]=A[i];
dq(1,n,1);
}
int Query(int l, int r) {
l++; r++;
if(l==r) return a[l];
int bits=__builtin_ctz(mask[l]^mask[r]);
bits++;
return Secret(tut[bits][l],tut[bits][r]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
78 ms |
4772 KB |
Execution killed with signal 11 |
2 |
Runtime error |
79 ms |
4648 KB |
Execution killed with signal 11 |
3 |
Runtime error |
79 ms |
4872 KB |
Execution killed with signal 11 |
4 |
Runtime error |
306 ms |
8532 KB |
Execution killed with signal 11 |
5 |
Runtime error |
307 ms |
8528 KB |
Execution killed with signal 11 |
6 |
Runtime error |
308 ms |
8604 KB |
Execution killed with signal 11 |
7 |
Runtime error |
304 ms |
8528 KB |
Execution killed with signal 11 |
8 |
Runtime error |
306 ms |
8568 KB |
Execution killed with signal 11 |
9 |
Runtime error |
304 ms |
8644 KB |
Execution killed with signal 11 |
10 |
Runtime error |
301 ms |
8532 KB |
Execution killed with signal 11 |