답안 #1057262

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1057262 2024-08-13T16:05:01 Z fryingduc 비밀 (JOI14_secret) C++17
0 / 100
283 ms 8372 KB
#include "bits/stdc++.h"
using namespace std;

#ifndef duc_debug
#include "secret.h"
#endif

const int maxn = 1e3 + 3;
int n, a[maxn]; 
int pref[maxn][maxn];

void solve(int l, int r) {
    int mid = (l + r) / 2;
    pref[mid][mid] = a[mid];
    pref[mid + 1][mid + 1] = a[mid + 1];
    for(int i = mid + 2; i <= r; ++i) {
        pref[mid + 1][i] = Secret(pref[mid + 1][i - 1], a[i]);
    }
    for(int i = mid - 1; i >= l; --i) {
        pref[mid][i] = Secret(pref[mid][i + 1], a[i]);
    }
    if(l < mid) {
        solve(l, mid - 1);
    }
    if(mid + 1 < r) {
        solve(mid + 1, r);
    }
}
void Init(int _n, int _a[]) { 
    n = _n;
    for(int i = 0; i < n; ++i) {
        a[i] = _a[i];
    }
    solve(0, n - 1);
}
int Query(int l, int r) {
    int x = 0, y = n - 1;
    while(x < y) {
        int mid = (l + r) / 2;
        if(l <= mid and mid < r) {
            return Secret(pref[mid][l], pref[mid + 1][r]);
        }
        else if(mid == r) return pref[mid][l];
        else if(mid < l) x = mid + 1;
        else y = mid;
    }
    return pref[x][x];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 65 ms 6736 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 72 ms 6740 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 66 ms 6740 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 283 ms 8372 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 279 ms 8288 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 252 ms 8276 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 956498690.
7 Incorrect 251 ms 8276 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 260 ms 8360 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 269 ms 8300 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 254 ms 8364 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.