# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
52455 |
2018-06-26T04:12:51 Z |
tataky(#1353) |
비밀 (JOI14_secret) |
C++11 |
|
610 ms |
9392 KB |
#include "secret.h"
int sp[9][1001], to[9][1001], n;
int a[1001];
int Query(int L, int R) {
if (L == R) return a[L];
int dist = R - L;
int ret, cur = L;
bool fst = true;
for (int h = 8; h >= 0; h--) if (dist&(1 << h)) {
if (h == 9) {
int val = Secret(sp[8][cur], sp[8][to[8][cur]]);
ret = val; fst = false;
}
if (fst) {
ret = sp[h][cur];
cur = to[h][cur];
fst = false;
}
else {
ret = Secret(ret, sp[h][cur]);
cur = to[h][cur];
}
}
return ret;
}
void setsparse() {
for (int i = 0; i < n - 1; i++) {
sp[i][0] = Secret(a[i], a[i + 1]);
to[i][0] = i + 1;
}
for (int h = 1; h < 9; h++) {
for (int i = 0; i < n; i++) if (i + (1 << h) < n) {
to[h][i] = to[h - 1][to[h - 1][i]];
sp[h][i] = Secret(sp[h - 1][i], sp[h - 1][to[h - 1][i]]);
}
}
}
void Init(int N, int A[]) {
n = N;
for (int i = 0; i < n; i++)
a[i] = A[i];
setsparse();
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:9:6: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
int ret, cur = L;
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
166 ms |
4692 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
171 ms |
4844 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
169 ms |
5052 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
597 ms |
8944 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
577 ms |
9252 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
586 ms |
9252 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
592 ms |
9268 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
591 ms |
9348 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
583 ms |
9348 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
610 ms |
9392 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |