Submission #137048

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1370482019-07-27 02:34:31mosesmayerSecret (JOI14_secret)C++17
100 / 100
610 ms5748 KiB
#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];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...