# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
25249 |
2017-06-21T04:42:24 Z |
시제연(#1061) |
비밀 (JOI14_secret) |
C++ |
|
689 ms |
6260 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int arr[1100];
struct node {
vector<int> l, r;
};
struct idxtree {
node tree[2100];
void init(int s, int e, int idx) {
int i, m = (s+e)>>1;
tree[idx].l.push_back(arr[s]);
for (i=s+1;i<=e;i++) tree[idx].l.push_back(Secret(tree[idx].l.back(),arr[i]));
tree[idx].r.push_back(arr[e]);
for (i=e-1;i>=s;i--) tree[idx].r.push_back(Secret(arr[i],tree[idx].r.back()));
reverse(tree[idx].r.begin(),tree[idx].r.end());
if (s==e) return;
init(s,m,idx*2);
init(m+1,e,idx*2+1);
}
int getv(int s, int e, int idx, int S, int E) {
int m = (s+e)>>1;
if (s==e) return arr[s];
if (e==E) return tree[idx].r[S-s];
if (s==S) return tree[idx].l[E-s];
if (E<=m) return getv(s,m,idx*2,S,E);
else if (m+1<=S) return getv(m+1,e,idx*2+1,S,E);
else return Secret(getv(s,m,idx*2,S,m),getv(m+1,e,idx*2+1,m+1,E));
}
} it;
void Init(int N, int A[]) {
n = N;
int i;
for (i=0;i<n;i++) arr[i]=A[i];
it.init(0,n-1,1);
}
int Query(int L, int R) {
return it.getv(0,n-1,1,L,R);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
186 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 8176, maximum number of calls to Secret by Query = 1 |
2 |
Incorrect |
183 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 8194, maximum number of calls to Secret by Query = 1 |
3 |
Incorrect |
203 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 8214, maximum number of calls to Secret by Query = 1 |
4 |
Incorrect |
683 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 17934, maximum number of calls to Secret by Query = 1 |
5 |
Incorrect |
636 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 17954, maximum number of calls to Secret by Query = 1 |
6 |
Incorrect |
643 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 17954, maximum number of calls to Secret by Query = 1 |
7 |
Incorrect |
649 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 17954, maximum number of calls to Secret by Query = 1 |
8 |
Incorrect |
649 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 17954, maximum number of calls to Secret by Query = 1 |
9 |
Incorrect |
689 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 17954, maximum number of calls to Secret by Query = 1 |
10 |
Incorrect |
649 ms |
6260 KB |
Output isn't correct - number of calls to Secret by Init = 17954, maximum number of calls to Secret by Query = 1 |