답안 #1067627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1067627 2024-08-20T21:59:53 Z Thunnus 비밀 (JOI14_secret) C++17
0 / 100
320 ms 8392 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
//#define int i64
#define vi vector<int>
#define vvi vector<vi>
#define vb vector<bool>
#define pii pair<int, int>
#define fi first
#define se second
#define sz(x) (int)(x).size() 

const int MX = 1e3 + 3;
int n, dp[MX][MX];

inline void divide(int le, int ri, int A[]){
    int mid = (le + ri) / 2;
    dp[mid][mid] = A[mid], dp[mid + 1][mid + 1] = A[mid + 1];
    for(int i = mid - 1; i >= le; i--){
        dp[mid][i] = Secret(dp[mid][i + 1], A[i]);
    }
    for(int i = mid + 2; i <= ri; i++){
        dp[mid + 1][i] = Secret(dp[mid + 1][i - 1], A[i]);
    }
    if(le < mid) divide(le, mid, A);
    if(mid + 1 < ri) divide(mid + 1, ri, A);
}

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

int Query(int L, int R){
    int le = 0, ri = n - 1, mid;
    while(ri > le){
        mid = (ri + le) / 2;
        if(L <= mid && R > mid) return Secret(dp[mid][L], dp[mid + 1][R]);
        if(mid == R) return dp[mid][L];
        if(mid < L)
            le = mid + 1;
        else
            ri = mid;
    }
    return dp[le][le];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 88 ms 4444 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015.
2 Incorrect 83 ms 4588 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 80 ms 4372 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 305 ms 8392 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 305 ms 8276 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 306 ms 8188 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445.
7 Incorrect 308 ms 8312 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 320 ms 8272 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 318 ms 8324 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 308 ms 8272 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.