# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
25256 |
2017-06-21T05:01:51 Z |
시제연(#1061) |
비밀 (JOI14_secret) |
C++ |
|
646 ms |
6256 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) {
if (s==e) {
tree[idx].l.push_back(arr[s]);
tree[idx].r.push_back(arr[s]);
return;
}
int i, m = (s+e)>>1;
init(s,m,idx*2);
init(m+1,e,idx*2+1);
if (idx==1) return;
for (i=s;i<=m;i++) tree[idx].l.push_back(tree[idx*2].l[i-s]);
for (i=m+1;i<=e;i++) tree[idx].l.push_back(Secret(tree[idx].l.back(),arr[i]));
for (i=e;i>m;i--) tree[idx].r.push_back(tree[idx*2+1].r[e-i]);
for (i=m;i>s;i--) tree[idx].r.push_back(Secret(arr[i],tree[idx].r.back()));
tree[idx].r.push_back(tree[idx].l.back());
}
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<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(tree[idx*2].r[m-S],tree[idx*2+1].l[E-m-1]);
}
} 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 |
159 ms |
6256 KB |
Wrong Answer: Query(264, 271) - expected : 675707686, actual : 4619042. |
2 |
Incorrect |
166 ms |
6256 KB |
Wrong Answer: Query(236, 238) - expected : 173116186, actual : 173115656. |
3 |
Incorrect |
169 ms |
6256 KB |
Wrong Answer: Query(64, 128) - expected : 469502, actual : 537340286. |
4 |
Incorrect |
629 ms |
6256 KB |
Wrong Answer: Query(63, 113) - expected : 329789484, actual : 329777196. |
5 |
Incorrect |
616 ms |
6256 KB |
Wrong Answer: Query(313, 329) - expected : 433799490, actual : 433733954. |
6 |
Incorrect |
633 ms |
6256 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 278446241. |
7 |
Correct |
609 ms |
6256 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
616 ms |
6256 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
626 ms |
6256 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
646 ms |
6256 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |