# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137048 | mosesmayer | Secret (JOI14_secret) | C++17 | 610 ms | 5748 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "secret.h"
#include <map>
using namespace std;
int spt[15][1005];
int a[1005];
map<pair<int,int>, int> asked;
int ask(int x, int y){
pair<int, int> u = make_pair(x, y);
if (asked.find(u) != asked.end()) return asked[u];
return asked[u] = Secret(x, y);
}
void rec(int l, int r, int d = 0){
if (l == r){
spt[d][l] = a[l];
return;
}
int md = (l + r) >> 1;
rec(l, md, d + 1); rec(md + 1, r, d + 1);
int prv = a[md];
spt[d][md] = a[md];
for (int i = md - 1; i >= l; --i){
spt[d][i] = ask(a[i], prv);
prv = spt[d][i];
}
prv = a[md + 1];
spt[d][md + 1] = a[md + 1];
for (int i = md + 2; i <= r; i++){
spt[d][i] = ask(prv, a[i]);
prv = spt[d][i];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |