답안 #568266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
568266 2022-05-25T04:32:37 Z gg123_pe 비밀 (JOI14_secret) C++14
0 / 100
511 ms 12288 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std; 
 
typedef long long ll; 
typedef pair<ll,ll> ii; 
#define f(i,a,b) for(int i = a; i < b; i++)
#define fa(i,a,b) for(int i = a; i >= b; i--)
 
#define ff first 
#define ss second 
 
const int N = 1005; 
const ll inf = 1e17 + 100; 
 
 
int n, a[N], L[N][N], R[N][N]; 
 
void go(int l, int r){
    if(l == r){
        L[l][l] = R[l][l] = a[l]; 
        return ;
    }
    int m = (l+r)>>1; 
    go(l, m), go(m+1, r); 
    
    L[m][m] = a[m]; 
    fa(i,m-1,l) L[m][i] = Secret(a[i], L[m][i+1]); 
 
    R[m+1][m+1] = a[m+1];
    f(i,m+2,r+1) R[m+1][i] = Secret(R[m+1][i-1], a[i]);   
}
void Init(int ni, int x[]){
    n = ni; 
    f(i,0,n) a[i] = x[i];
 
    go(0, n-1);  
}
 
int Query(int x, int y){
    int l = 0, r = n-1; 
    while(1){
        int m = (l+r)>>1; 
        if(y == m)
            return L[x][y]; 
        if(x == m+1)
            return R[x][y];
        if(x <= m and m+1 <= y)
            return Secret(L[x][m], R[m+1][y]); 
 
        if(y < m) r = m;  
        else l = m+1; 
    }
    return -1; 
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 118 ms 6476 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 860971434.
2 Incorrect 118 ms 6476 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 712055264.
3 Incorrect 117 ms 6460 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 539361598.
4 Incorrect 452 ms 12200 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 374358039.
5 Incorrect 436 ms 12132 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 483966986.
6 Incorrect 440 ms 12152 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 3875264.
7 Incorrect 442 ms 12160 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 177907722.
8 Incorrect 445 ms 12136 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 489869504.
9 Incorrect 463 ms 12200 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 702032905.
10 Incorrect 511 ms 12288 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 336488262.