답안 #823803

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
823803 2023-08-13T07:10:52 Z Alihan_8 비밀 (JOI14_secret) C++17
0 / 100
365 ms 4328 KB
#include <bits/stdc++.h>

#include "secret.h"

using namespace std;

#define all(x) x.begin(), x.end()
#define pb push_back
#define ln '\n'
//#define int long long

template <class _T>
bool chmin(_T &x, const _T &y){
    bool flag = false;
    if ( x > y ){
        x = y; flag |= true;
    }
    return flag;
}

template <class _T>
bool chmax(_T &x, const _T &y){
    bool flag = false;
    if ( x < y ){
        x = y; flag |= true;
    }
    return flag;
}

const int N = 1e3 + 1;

struct SegTree{
    int T[N * 4], n;
    void build(vector <int> &a){
        n = (int)a.size();
        auto F = [&](auto &F, int v, int l, int r) -> void{
            if ( l == r ){
                T[v] = a[l];
                return;
            }
            int md = (l + r) >> 1;
            F(F, v * 2, l, md), F(F, v * 2 + 1, md + 1, r);
            T[v] = Secret(T[v * 2], T[v * 2 + 1]);
        };
        F(F, 1, 0, n - 1);
    }
    int get(int v, int l, int r, int tl, int tr){
        if ( l > tr or r < tl ){
            return -1;
        }
        if ( l <= tl and r >= tr ){
            return T[v];
        }
        int md = (l + r) >> 1;
        int L = get(v * 2, l, md, tl, tr), R = get(v * 2 + 1, md + 1, r, tl, tr);
        if ( L == -1 ) swap(L, R);
        if ( R != -1 ){
            L = Secret(L, R);
        }
        return L;
    }
    int get(int L, int R){
        return get(1, 0, n - 1, L, R);
    }
} tuf;

void Init(int n, int A[]) {
    vector <int> a;
    for ( int i = 0; i < n; i++ ){
        a.pb(A[i]);
    }
    tuf.build(a);
}

int Query(int L, int R) {
    return tuf.get(L, R);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 104 ms 2260 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 303446001.
2 Incorrect 93 ms 2368 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 401641632.
3 Incorrect 96 ms 2364 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 76556308.
4 Incorrect 348 ms 4188 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 652837005.
5 Incorrect 365 ms 4328 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 947541334.
6 Incorrect 348 ms 4272 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 941867304.
7 Incorrect 356 ms 4328 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 690201657.
8 Incorrect 365 ms 4188 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 812884248.
9 Incorrect 356 ms 4180 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 299244610.
10 Incorrect 351 ms 4224 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 875372551.