# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
25246 |
2017-06-21T04:26:38 Z |
김동현(#1058) |
Secret (JOI14_secret) |
C++14 |
|
616 ms |
5276 KB |
#include "secret.h"
#include <cstdio>
const int sz = 1024;
struct Seg{
int dat[2 * sz], lch[2 * sz][10], rch[2 * sz][10];
void ini(int n, int a[]){
for(int i = 0; i < n; i++) dat[i + sz] = lch[i + sz][0] = rch[i + sz][0] = a[i];
for(int i = sz - 1; i >= 1; i--){
dat[i] = Secret(dat[2 * i], dat[2 * i + 1]);
if(i == 1) break;
lch[i][0] = rch[i][0] = dat[i];
for(int j = 1, t = 2 * i - 1; t < 2 * sz; j++, t = 2 * t - 1){
lch[i][j] = Secret(dat[t], lch[i][j - 1]);
}
for(int j = 1, t = 2 * i + 2; t < 2 * sz; j++, t = 2 * t + 2){
rch[i][j] = Secret(rch[i][j - 1], dat[t]);
}
}
}
int get(int s, int e){
int lc = -1, rc = -1, ln, rn;
for(s += sz, e += sz; s <= e; s /= 2, e /= 2){
if(s % 2 == 1){ lc++; ln = s++; }
if(e % 2 == 0){ rc++; rn = e--; }
}
if(lc == -1) return rch[rn][rc];
if(rc == -1) return lch[ln][lc];
return Secret(lch[ln][lc], rch[rn][rc]);
}
} S;
void Init(int N, int A[]) {
S.ini(N, A);
}
int Query(int L, int R) {
return S.get(L, R);
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:27:33: warning: 'rn' may be used uninitialized in this function [-Wmaybe-uninitialized]
if(lc == -1) return rch[rn][rc];
^
secret.cpp:22:29: note: 'rn' was declared here
int lc = -1, rc = -1, ln, rn;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
156 ms |
5276 KB |
Wrong Answer: Query(113, 206) - expected : 536899947, actual : 5334504. |
2 |
Incorrect |
163 ms |
5276 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 546930944. |
3 |
Incorrect |
163 ms |
5276 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 70674810. |
4 |
Incorrect |
599 ms |
5276 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 112771743. |
5 |
Incorrect |
616 ms |
5276 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 647659870. |
6 |
Incorrect |
603 ms |
5276 KB |
Wrong Answer: Query(888, 892) - expected : 825894562, actual : 833275802. |
7 |
Incorrect |
609 ms |
5276 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 261096528. |
8 |
Incorrect |
609 ms |
5276 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 164739416. |
9 |
Incorrect |
613 ms |
5276 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 165554286. |
10 |
Incorrect |
616 ms |
5276 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 71657921. |