# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
735796 |
2023-05-04T16:45:02 Z |
Wael |
Secret (JOI14_secret) |
C++14 |
|
474 ms |
8396 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int long long
#define F first
#define S second
//#define endl '\n'
#define INT INT_MAX
int const M = 1e3 + 30 , N = 3e6 , lg = 25 , mod = 1e9 + 7;
int dx[] = {0 , 0 , -1 , 1 , 1 , 1 , -1 , -1};
int dy[] = {1 , -1 , 0 , 0 , 1 , -1 , 1 , -1};
int T , n , j , a[M] , Q , l , r , Size = 1024 , s[M] , ans[M][M] , cnt;
void Go(int x = 1 , int lx = 1 , int rx = Size) {
if(lx == rx) return;
int mid = (lx + rx) / 2;
int a = mid , b = mid + 1;
for(int i = b + 1 ; i <= rx ; ++i) ans[b][i] = Secret(ans[b][i - 1] , s[i]);
for(int i = a - 1 ; i >= lx ; --i) ans[i][a] = Secret(s[i] , ans[i + 1][a]);
Go(2 * x , lx , mid);
Go(2 * x + 1 , mid + 1 , rx);
}
int Get(int l , int r , int x = 1 , int lx = 1 , int rx = Size) {
int mid = (lx + rx) / 2;
if((mid >= l && mid <= r)) {
int res = 0;
if(mid < r) res = Secret(ans[l][mid] , ans[mid + 1][r]);
else res = ans[l][mid];
return res;
}
if(l > mid) return Get(l , r , 2 * x + 1 , mid + 1 , rx);
else return Get(l , r , 2 * x, lx , mid);
}
void Init(int sz , int ar[]) {
n = sz;
for(int i = 1 ; i <= n ; ++i) s[i] = ar[i - 1] , ans[i][i] = s[i];
Go();
}
int Query(int l , int r) {
++cnt;
++l , ++r;
if(l == r) return s[l];
return Get(l , r);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
136 ms |
6464 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
2 |
Partially correct |
129 ms |
6396 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
3 |
Partially correct |
153 ms |
6404 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
4 |
Partially correct |
440 ms |
8392 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
5 |
Partially correct |
466 ms |
8392 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
6 |
Partially correct |
438 ms |
8396 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
7 |
Partially correct |
443 ms |
8360 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
8 |
Partially correct |
449 ms |
8316 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
9 |
Partially correct |
474 ms |
8376 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
10 |
Partially correct |
463 ms |
8292 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |