Submission #735834

# Submission time Handle Problem Language Result Execution time Memory
735834 2023-05-04T18:42:00 Z sandry24 Secret (JOI14_secret) C++17
0 / 100
469 ms 12276 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
 
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second

const int MAX_N = 1005;
int meetpoint[MAX_N][MAX_N];
int res[MAX_N][MAX_N];

void build(int l, int r){
    if(l >= r)
        return;
    int mid = (l+r)/2;
    for(int i = l; i <= mid; i++){
        for(int j = mid+1; j <= r; j++)
            meetpoint[i][j] = mid;
    }
    for(int i = mid+2; i <= r; i++)
        res[mid+1][i] = Secret(res[mid+1][i-1], res[i][i]);
    for(int i = mid-1; i >= l; i--)
        res[i][mid] = Secret(res[i+1][mid], res[i][i]);
    build(l, mid);
    build(mid+1, r);
}

void Init(int N, int A[]){
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            res[i][j] = (i == j ? A[i] : -1);
        }
    }
    build(0, N-1);
}

int Query(int L, int R){
    if(res[L][R] != -1)
        return res[L][R];
    int mid = meetpoint[L][R];
    return Secret(res[L][mid], res[mid+1][R]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 6452 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 114 ms 6388 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 117 ms 6396 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 469 ms 12228 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 443 ms 12236 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 450 ms 12276 KB Wrong Answer: Query(653, 654) - expected : 227441904, actual : 93182529.
7 Incorrect 428 ms 12204 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 433 ms 12172 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 433 ms 12124 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 445 ms 12108 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.