# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
916461 |
2024-01-26T01:08:19 Z |
biank |
Secret (JOI14_secret) |
C++14 |
|
397 ms |
8784 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define dforsn(i,s,n) for(int i=int(n)-1;i>=int(s);i--)
#define dforn(i,n) for(int i=int(n)-1;i>=0;i--)
const int MAXN = 1000;
const int MAXL = 10;
int val[MAXL][MAXN];
int n;
void build(int l, int r, int a[], int h) {
int m = (l+r)/2;
val[h][m] = a[m];
if(l==r) return;
//prefix
val[h][m+1] = a[m+1];
forsn(i,m+2,r+1) {
val[h][i] = Secret(val[h][i-1], a[i]);
}
//suffix
dforsn(i,l,m) {
val[h][i] = Secret(a[i], val[h][i+1]);
}
build(l,m-1,a,h+1);
build(m+2,r,a,h+1);
}
void Init(int N, int a[]) {
n=N;
build(0,n-1,a,0);
}
int solve(int l, int r, int a, int b, int h) {
if(l==r) return val[h][a];
int m=(l+r)/2;
if(b<m) return solve(l,m-1,a,b,h+1);
if(a>m+1) return solve(m+2,r,a,b,h+1);
return Secret(val[h][a], val[h][b]);
}
int Query(int L, int R) {
return solve(0,n-1,L,R,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
102 ms |
5372 KB |
Execution killed with signal 11 |
2 |
Runtime error |
102 ms |
5368 KB |
Execution killed with signal 11 |
3 |
Runtime error |
105 ms |
5264 KB |
Execution killed with signal 11 |
4 |
Runtime error |
380 ms |
8680 KB |
Execution killed with signal 11 |
5 |
Runtime error |
381 ms |
8708 KB |
Execution killed with signal 11 |
6 |
Runtime error |
374 ms |
8756 KB |
Execution killed with signal 11 |
7 |
Runtime error |
377 ms |
8696 KB |
Execution killed with signal 11 |
8 |
Runtime error |
375 ms |
8784 KB |
Execution killed with signal 11 |
9 |
Runtime error |
380 ms |
8700 KB |
Execution killed with signal 11 |
10 |
Runtime error |
397 ms |
8700 KB |
Execution killed with signal 11 |