Submission #957086

# Submission time Handle Problem Language Result Execution time Memory
957086 2024-04-02T23:50:45 Z MuntherCarrot Secret (JOI14_secret) C++14
0 / 100
395 ms 8296 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;

// int Secret(int X, int Y);

const int MAXN = 1010;
int block[MAXN][MAXN];
int n;

void div(int l, int r, int A[]){
    if(l == r){
        block[l][l] = A[l];
        return;
    }
    int mid = (l + r) / 2;
    block[mid][mid] = A[mid];
    block[mid + 1][mid + 1] = A[mid + 1];
    for(int i = mid - 1; i >= l; i--){
        block[mid][i] = Secret(A[i], block[mid][i + 1]);
    }
    for(int i = mid + 2; i <= r; i++){
        block[mid + 1][i] = Secret(block[mid + 1][i - 1], A[i]);
    }
    div(l, mid, A);
    div(mid + 1, r, A);
}

void Init(int N, int A[]){
    n = N;
    div(0, N - 1, A);
}

int Query(int L, int R){
    int l = 0, r = n - 1;
    while(l < r){
        int mid = (l + r) / 2;
        if(L <= mid && mid < R){
            return Secret(block[mid][L], block[mid][R]);
        }
        else if(mid == R){
            return block[mid][L];
        }
        else if(mid < L){
            l = mid + 1;
        }
        else{
            r = mid;
        }
    }
    return block[l][l];
}

// by me
# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 6740 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805576266.
2 Incorrect 101 ms 6740 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064.
3 Incorrect 110 ms 6748 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136730926.
4 Incorrect 383 ms 8280 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 870547617.
5 Incorrect 378 ms 8284 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 976357712.
6 Incorrect 378 ms 8272 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 942318537.
7 Incorrect 377 ms 8284 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 781793354.
8 Incorrect 389 ms 8296 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 499418120.
9 Incorrect 380 ms 8280 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277351906.
10 Incorrect 395 ms 8284 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 274498057.