# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
52549 |
2018-06-26T07:06:24 Z |
노영훈(#1364) |
Secret (JOI14_secret) |
C++11 |
|
636 ms |
8420 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
const int MX=1001, B=32;
int n, A[MX];
vector<int> P;
// p <= x < q, p < y <= q
int D[MX][MX]; // [x, y)
int sz;
void _fill(){
for(int i=0; i<sz-1; i++){
int p=P[i], q=P[i+1];
for(int x=p; x<q; x++){
D[x][x+1]=A[x];
for(int y=x+2; y<=q; y++)
D[x][y]=Secret(D[x][y-1], A[y-1]);
}
}
for(int i=0; i<sz; i++){
for(int j=i+2; j<sz; j++){
int p=P[i], q=P[j];
D[p][q]=Secret(D[p][q-B], D[q-B][q]);
}
}
/*
cout<<"\nD: \n";
for(int i=0; i<n; i++){
for(int j=1; j<=n; j++){
cout<<D[i][j]<<' ';
}
cout<<'\n';
}
*/
}
void Init(int N, int _A[]) {
n=N;
for(int i=0; i<n; i++) A[i]=_A[i];
for(int p=0; p<n; p+=B) P.push_back(p);
P.push_back(n);
sz=P.size();
_fill();
}
int Query(int L, int R) {
int l=L, r=R+1;
int a=-1,b=-1;
for(int i=0; i<sz; i++) if(l<P[i]){ a=P[i]; break; }
for(int i=sz-1; i>=0; i--) if(P[i]<r){ b=P[i]; break; }
if(b<a) return D[l][r];
if(a==b) return Secret(D[l][a], D[b][r]);
else return Secret(Secret(D[l][a], D[a][b]), D[b][r]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
190 ms |
4476 KB |
Output isn't correct - number of calls to Secret by Init = 8025, maximum number of calls to Secret by Query = 2 |
2 |
Incorrect |
182 ms |
4520 KB |
Output isn't correct - number of calls to Secret by Init = 8056, maximum number of calls to Secret by Query = 2 |
3 |
Incorrect |
185 ms |
4520 KB |
Output isn't correct - number of calls to Secret by Init = 8072, maximum number of calls to Secret by Query = 2 |
4 |
Incorrect |
602 ms |
8324 KB |
Output isn't correct - number of calls to Secret by Init = 15893, maximum number of calls to Secret by Query = 2 |
5 |
Incorrect |
599 ms |
8324 KB |
Output isn't correct - number of calls to Secret by Init = 15900, maximum number of calls to Secret by Query = 2 |
6 |
Incorrect |
605 ms |
8324 KB |
Output isn't correct - number of calls to Secret by Init = 15900, maximum number of calls to Secret by Query = 1 |
7 |
Incorrect |
636 ms |
8324 KB |
Output isn't correct - number of calls to Secret by Init = 15900, maximum number of calls to Secret by Query = 2 |
8 |
Incorrect |
595 ms |
8324 KB |
Output isn't correct - number of calls to Secret by Init = 15900, maximum number of calls to Secret by Query = 2 |
9 |
Incorrect |
596 ms |
8360 KB |
Output isn't correct - number of calls to Secret by Init = 15900, maximum number of calls to Secret by Query = 2 |
10 |
Incorrect |
621 ms |
8420 KB |
Output isn't correct - number of calls to Secret by Init = 15900, maximum number of calls to Secret by Query = 2 |