답안 #383853

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
383853 2021-03-30T21:58:58 Z JerryLiu06 비밀 (JOI14_secret) C++11
0 / 100
505 ms 4464 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;

int dat[10][1010], mask[1010], A[1010];

void divide(int L, int R, int lev, int A[]) {
    if (L == R) return ; int mid = (L + R) / 2;

    dat[lev][mid] = A[mid]; for (int i = mid - 1; i >= L; i--) dat[lev][i] = Secret(A[i], dat[lev][i + 1]);
    dat[lev][mid + 1] = A[mid + 1]; for (int i = mid + 2; i <= R; i++) dat[lev][i] = Secret(A[i], dat[lev][i - 1]);

    for (int i = mid + 1; i <= R; i++) mask[i] ^= (1 << lev);

    divide(L, mid, lev + 1, A); divide(mid + 1, R, lev + 1, A);
}
void Init(int N, int arr[]) { for (int i = 0; i < N; i++) A[i] = arr[i]; divide(0, N - 1, 0, A); }

int Query(int L, int R) { if (L == R) return A[L];
    int lev = __builtin_ctz(mask[L] ^ mask[R]); return Secret(dat[lev][L], dat[lev][R]);
}

Compilation message

secret.cpp: In function 'void divide(int, int, int, int*)':
secret.cpp:9:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    9 |     if (L == R) return ; int mid = (L + R) / 2;
      |     ^~
secret.cpp:9:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    9 |     if (L == R) return ; int mid = (L + R) / 2;
      |                          ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 133 ms 2540 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 131 ms 2412 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 134 ms 2540 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 490 ms 4332 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 500 ms 4332 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 505 ms 4328 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 495 ms 4332 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 495 ms 4292 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 497 ms 4464 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 495 ms 4332 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.