#include <bits/stdc++.h>
#include "secret.h"
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define fi first
#define se second
#define INF 1e9
#define eps 1e-7
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
#define V 450
using namespace std;
const int MOD = 1e9+7;
const int nax = 1005;
int n;
vi s;
int t[nax][nax];
void solve(int l, int r){
if(l >= r-1) return;
int md = (l+r)/2;
t[md][md] = s[md];
t[md+1][md+1] = s[md+1];
cout << l << " " << r << endl;
for (int i = md+1; i <= r; ++i)
{
t[md][i] = Secret(t[md][i-1],s[i]);
cout << i << endl;
}
for (int i = md-1; i >= l; --i)
{
t[i][md] = Secret(t[i+1][md],s[i]);
cout << i << endl;
}
solve(l,md),solve(md+1,r);
}
void Init(int N, int A[]){
n = N;
for (int i = 0; i < N; ++i)
{
s.pb(A[i]);
}
solve(0,n-1);
}
int Query(int L, int R){
int l = 0, r = n-1;
int md = (l+r)/2;
while(!(L <= md && md <= R)){
md = (l+r)/2;
if(md == R) return t[L][md];
if(md > R)
r = md;
else
l = md+1;
}
return Secret(t[L][md],t[md][R]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
116 ms |
4468 KB |
Do not print anything to standard output |
2 |
Incorrect |
114 ms |
4528 KB |
Do not print anything to standard output |
3 |
Incorrect |
117 ms |
4420 KB |
Do not print anything to standard output |
4 |
Incorrect |
419 ms |
8260 KB |
Do not print anything to standard output |
5 |
Incorrect |
421 ms |
8348 KB |
Do not print anything to standard output |
6 |
Incorrect |
459 ms |
8260 KB |
Do not print anything to standard output |
7 |
Incorrect |
436 ms |
8256 KB |
Do not print anything to standard output |
8 |
Incorrect |
420 ms |
8252 KB |
Do not print anything to standard output |
9 |
Incorrect |
428 ms |
8276 KB |
Do not print anything to standard output |
10 |
Incorrect |
455 ms |
8232 KB |
Do not print anything to standard output |