# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
634038 |
2022-08-23T17:48:43 Z |
Ronin13 |
Secret (JOI14_secret) |
C++14 |
|
544 ms |
4940 KB |
#include "secret.h"
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
#define f first
#define s second
#define pii pair<int,int>
using namespace std;
map<pii, int> mp;
const int NMAX = 10001;
int a[NMAX];
int n;
int xx;
void build(int l, int r){
int m = (l + r) / 2;
if(l == r){
mp[{l, r}] = a[l];
return;
}
build(l, m);
build(m + 1, r);
if(l == 0 && r == n - 1) return;
if((l != xx + 1) || (r != n - 1)){
for(int i = l; i <= m; i++){
int x = mp[{i, m}];
int y = mp[{m + 1, r}];
mp[{i, r}] = Secret(x, y);
}
}
if(r - l > 1){
if((l != 0) || (r != xx)){
for(int i = r; i >= m + 1; i--){
int x = mp[{l, m}];
int y = mp[{m + 1, i}];
mp[{l, i}] = Secret(x, y);
}}}
}
void Init(int N, int A[]) {
n = N;
for(int i = 0; i < n; i++) a[i] = A[i];
//cout << 1;
build(0, n - 1);
xx = (n - 1) / 2;
}
int Query(int L, int R) {
//cout << n << "\n";
int l = 0, r = n - 1;
if(L == R){
return a[R];
}
while(true){
int m = (l + r) / 2;
if(R <= m) {
r = m;
continue;
}
if(L > m){
l = m + 1;
continue;
}
break;
}
int m = (l + r) / 2;
int x = mp[{L, m}];
int y = mp[{m + 1, R}];
return Secret(x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
2636 KB |
Output is correct - number of calls to Secret by Init = 3832, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
135 ms |
2624 KB |
Output is correct - number of calls to Secret by Init = 3840, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
136 ms |
2624 KB |
Output is correct - number of calls to Secret by Init = 3850, maximum number of calls to Secret by Query = 1 |
4 |
Partially correct |
473 ms |
4940 KB |
Output isn't correct - number of calls to Secret by Init = 8479, maximum number of calls to Secret by Query = 1 |
5 |
Partially correct |
459 ms |
4828 KB |
Output isn't correct - number of calls to Secret by Init = 8488, maximum number of calls to Secret by Query = 1 |
6 |
Partially correct |
487 ms |
4812 KB |
Output isn't correct - number of calls to Secret by Init = 8488, maximum number of calls to Secret by Query = 1 |
7 |
Partially correct |
544 ms |
4864 KB |
Output isn't correct - number of calls to Secret by Init = 8488, maximum number of calls to Secret by Query = 1 |
8 |
Partially correct |
497 ms |
4856 KB |
Output isn't correct - number of calls to Secret by Init = 8488, maximum number of calls to Secret by Query = 1 |
9 |
Partially correct |
466 ms |
4852 KB |
Output isn't correct - number of calls to Secret by Init = 8488, maximum number of calls to Secret by Query = 1 |
10 |
Partially correct |
498 ms |
4844 KB |
Output isn't correct - number of calls to Secret by Init = 8488, maximum number of calls to Secret by Query = 1 |