답안 #160558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
160558 2019-10-28T13:26:54 Z nvmdava 비밀 (JOI14_secret) C++17
0 / 100
620 ms 8604 KB
#include "secret.h"
#include <bits/stdc++.h>

int val[1005][1005];
int a[1005];

void get(int l, int r){
    if(l > r)
        return;
    if(l == r){
        val[l][l] = a[l];
        return;
    }

    int m1 = (l + r) >> 1;
    int m2 = m1 + 1;

    val[m1][m1] = a[m1];
    val[m2][m2] = a[m2];

    for(int i = m1 - 1; i >= l; i--){
        val[i][m1] = val[m1][i] = Secret(val[i + 1][m1], a[i]);
    }
    for(int i = m2 + 1; i <= r; i++){
        val[i][m2] = val[m2][i] = Secret(val[i - 1][m2], a[i]);
    }

    get(l, m1 - 1);
    get(m2 + 1, r);
}

void Init(int N, int A[]){

    memset(val, -1, sizeof val);

    for(int i = 0; i < N; i++)
        a[i] = A[i];

    get(0, 1000);

}

int Query(int L, int R) {
    if(val[L][R])
        return val[L][R];
    for(int i = L; i < R; i++){
        if(val[L][i] != -1 && val[i + 1][R] != -1)
            return Secret(val[L][i], val[i + 1][R]);
    }
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:50:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 175 ms 6396 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : -1.
2 Incorrect 174 ms 6392 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : -1.
3 Incorrect 168 ms 6388 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : -1.
4 Incorrect 608 ms 8372 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : -1.
5 Incorrect 607 ms 8384 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : -1.
6 Incorrect 599 ms 8340 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : -1.
7 Incorrect 606 ms 8604 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : -1.
8 Incorrect 595 ms 8300 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : -1.
9 Incorrect 599 ms 8404 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : -1.
10 Incorrect 620 ms 8440 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : -1.