답안 #565532

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565532 2022-05-21T04:36:38 Z ac2hu 비밀 (JOI14_secret) C++14
0 / 100
472 ms 12156 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
const int _N = 1e3 + 1;
int RR[_N][_N];// right[i][j] = query(j, i)
int LL[_N][_N]; // left[i][j] = query(i, j)
vector<int> temp;
int a[_N];
int n;
int c = 0;
void build(int l,int r){
    if(l == r)return;
    if(l + 1 == r)return;
    int mid = (l + r)/2; 
    assert(mid < r && l <= mid);
    temp.push_back(mid);
    RR[mid + 1][mid] = a[mid + 1];
    for(int i = mid + 2;i<=r;i++){
        RR[i][mid] = Secret(RR[i - 1][mid],  a[i]);
    }
    LL[mid][mid] = a[mid];
    for(int i = mid - 1;i>=l;i--){
        LL[i][mid] = Secret(a[i], LL[i + 1][mid]);
    }
    build(l, mid);
    build(mid + 1, r);
}
void Init(int N, int A[]) {
    for(int i = 0;i<N;i++)
        a[i] = A[i];
    build(1, N - 1);
}
int Query(int L, int R) {
    if(L == R){
        return a[L];
    }
    else if(L + 1 == R)
        return Secret(a[L], a[R]);
    else{
        for(auto e : temp){
            if(L <= e && e < R)return Secret(LL[L][e], RR[R][e]);
        }
        assert(false);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 114 ms 6464 KB Wrong Answer: Query(0, 357) - expected : 574893848, actual : 588408218.
2 Incorrect 125 ms 6304 KB Wrong Answer: Query(0, 218) - expected : 167946665, actual : 979444105.
3 Incorrect 117 ms 6404 KB Wrong Answer: Query(0, 359) - expected : 218322958, actual : 813875538.
4 Incorrect 460 ms 12088 KB Wrong Answer: Query(0, 229) - expected : 58228789, actual : 359301677.
5 Incorrect 459 ms 12108 KB Wrong Answer: Query(0, 371) - expected : 250238024, actual : 720031834.
6 Incorrect 464 ms 12024 KB Wrong Answer: Query(0, 7) - expected : 421989048, actual : 145425737.
7 Incorrect 452 ms 12156 KB Wrong Answer: Query(0, 993) - expected : 589312106, actual : 692290594.
8 Incorrect 472 ms 12000 KB Wrong Answer: Query(0, 839) - expected : 428261768, actual : 881024464.
9 Incorrect 458 ms 12064 KB Wrong Answer: Query(0, 930) - expected : 424418475, actual : 29375662.
10 Incorrect 470 ms 12060 KB Wrong Answer: Query(0, 893) - expected : 611994251, actual : 539903305.