Submission #52579

# Submission time Handle Problem Language Result Execution time Memory
52579 2018-06-26T07:41:44 Z 노영훈(#1364) Secret (JOI14_secret) C++11
0 / 100
639 ms 8532 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

const int MX=1001, B=21;

int n, A[MX];

int D[MX][MX];

void _fill(int s=0, int e=n-1){
    int m=(s+e)/2;
    D[m][m]=A[m];
    for(int x=m-1; x>=s; x--){
        D[x][m]=Secret(A[x], D[x+1][m]);
    }
    D[m+1][m+1]=A[m+1];
    for(int y=m+1; y<=e; y++)
        D[m+1][y]=Secret(D[m+1][y-1], A[y]);
    if(s==e) return;
    _fill(s,m);
    _fill(m+1,e);
}

void Init(int N, int _A[]) {
    n=N;
    for(int i=0; i<n; i++) A[i]=_A[i];

    _fill();
    /*
    cout<<"\nD: \n";
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cout<<D[i][j]<<' ';
        }
        cout<<'\n';
    }
    */
}
int solve(int l, int r, int s=0, int e=n-1){
    int m=(s+e)/2;
    if(l<=m && m+1<=r){
        // printf("%d~%d: [%d, %d]\n", l, r, s, e);
        // printf("%d * %d\n", D[l][m], D[m+1][r]);
        return Secret(D[l][m], D[m+1][r]);
    }
    if(r<=m) return solve(l,r,s,m);
    else return solve(l,r,m+1,e);
}

int Query(int L, int R) {
    if(L==R) return A[L];
    return solve(L,R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 180 ms 4408 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537.
2 Incorrect 162 ms 4492 KB Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529.
3 Incorrect 163 ms 4492 KB Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628.
4 Incorrect 616 ms 8440 KB Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619.
5 Incorrect 624 ms 8532 KB Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752.
6 Incorrect 633 ms 8532 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 950134466.
7 Incorrect 639 ms 8532 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
8 Incorrect 621 ms 8532 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
9 Incorrect 625 ms 8532 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
10 Incorrect 607 ms 8532 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1