답안 #740334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
740334 2023-05-12T10:56:31 Z TheOpChicken 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
const int N = 1e3;
int val[N][N];
int a[N];
void rec(int l, int r){
    if(l > r)
        return;
    if(l == r){
        val[l][l] = a[l];
        return;
    }
    int mid = (l + r)/2;
    // (l, mid), (l + 1, mid), ..., (mid, mid)
    val[mid][mid] = a[mid];
    for(int i = mid-1; i >= l; i--){
      val[i][mid] = Secret(a[i], val[i+1][mid]);
    }
  val[mid+1][mid+1] = a[mid+1];
    for(int i = mid + 2; i <= r; i++){
        val[mid+1][i] = Secret(val[mid+1][i-1], a[i])l
    }
    rec(l, mid);
    rec(mid + 1, r);
}
void Init(int n, int A[]) {
    for(int i = 0; i < n; i++){
        a[i] = A[i];
    }
    memset(val, -1, sizeof(val));
    rec(0, n - 1);
}
 
int Query(int L, int R) {
    if(L == R)
        return val[L][L];
    for(int i = L; i + 1 <= R; i++){
        if(val[L][i] != -1 && val[i + 1][R] != -1)
            return Secret(val[L][i], val[i + 1][R]);
    }
    if(val[L][R] != -1)
        return val[L][R];
    return -1;
}

Compilation message

secret.cpp: In function 'void rec(int, int)':
secret.cpp:21:54: error: expected ';' before 'l'
   21 |         val[mid+1][i] = Secret(val[mid+1][i-1], a[i])l
      |                                                      ^
      |                                                      ;