Submission #565531

# Submission time Handle Problem Language Result Execution time Memory
565531 2022-05-21T04:20:55 Z ac2hu Secret (JOI14_secret) C++14
0 / 100
760 ms 24512 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;
void build(int l,int r){
    if(l + 1 < r){
        int mid = (l + r + 1)/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>=0;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);
    }
}
# Verdict Execution time Memory Grader output
1 Partially correct 197 ms 6348 KB Output isn't correct - number of calls to Secret by Init = 88191, maximum number of calls to Secret by Query = 1
2 Partially correct 207 ms 6456 KB Output isn't correct - number of calls to Secret by Init = 88708, maximum number of calls to Secret by Query = 1
3 Partially correct 213 ms 6280 KB Output isn't correct - number of calls to Secret by Init = 88936, maximum number of calls to Secret by Query = 1
4 Partially correct 753 ms 12104 KB Output isn't correct - number of calls to Secret by Init = 335325, maximum number of calls to Secret by Query = 1
5 Partially correct 738 ms 12088 KB Output isn't correct - number of calls to Secret by Init = 336310, maximum number of calls to Secret by Query = 1
6 Runtime error 745 ms 24512 KB Execution killed with signal 6
7 Partially correct 742 ms 12044 KB Output isn't correct - number of calls to Secret by Init = 336310, maximum number of calls to Secret by Query = 1
8 Partially correct 729 ms 12032 KB Output isn't correct - number of calls to Secret by Init = 336310, maximum number of calls to Secret by Query = 1
9 Partially correct 713 ms 12024 KB Output isn't correct - number of calls to Secret by Init = 336310, maximum number of calls to Secret by Query = 1
10 Partially correct 760 ms 12168 KB Output isn't correct - number of calls to Secret by Init = 336310, maximum number of calls to Secret by Query = 1