답안 #957080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957080 2024-04-02T23:45:07 Z MuntherCarrot 비밀 (JOI14_secret) C++14
0 / 100
393 ms 8372 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;

// int Secret(int X, int Y);

const int MAXN = 1010;
int block[MAXN][MAXN];

void div(int l, int r, int A[]){
    if(l == r){
        block[l][l] = A[l];
        return;
    }
    int mid = (l + r) / 2;
    block[mid][mid] = A[mid];
    block[mid + 1][mid + 1] = A[mid + 1];
    for(int i = mid - 1; i >= l; i--){
        block[mid][i] = Secret(A[i], block[mid][i + 1]);
    }
    for(int i = mid + 2; i <= r; i++){
        block[mid + 1][i] = Secret(block[mid + 1][i - 1], A[i]);
    }
    div(l, mid, A);
    div(mid + 1, r, A);
}

void Init(int N, int A[]){
    div(0, N - 1, A);
}

int Query(int L, int R){
    int l, r;
    cin >> l >> r;
    while(l <= r){
        int mid = (l + r) / 2;
        if(L <= mid && mid < R){
            return Secret(block[mid][L], block[mid][R]);
        }
        else if(mid == R){
            return block[mid][L];
        }
        else if(mid < L){
            l = mid + 1;
        }
        else{
            r = mid - 1;
        }
    }
    return 0;
}

// by me
# 결과 실행 시간 메모리 Grader output
1 Incorrect 103 ms 6992 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 0.
2 Incorrect 100 ms 6736 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 102 ms 6732 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 0.
4 Incorrect 374 ms 8368 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 0.
5 Incorrect 375 ms 8276 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 0.
6 Incorrect 393 ms 8372 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0.
7 Incorrect 393 ms 8360 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 392 ms 8360 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 0.
9 Incorrect 376 ms 8276 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 387 ms 8360 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.