답안 #391241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
391241 2021-04-18T09:56:42 Z Vladth11 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "
#include "secret.h"

using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <long double, pii> muchie;

const ll NMAX = 300001;
const ll INF = (1LL << 60);
const ll MOD = 998244353;
const ll BLOCK = 225;
const ll base = 31;
const ll nr_of_bits = 21;

int table[1001][1001];

void divide(int l, int r){
    int mid = (l + r) / 2;
    for(int i = mid - 1; i >= l; i--){
        table[i][mid] = Secret(table[i + 1][mid], table[i][i]);
    }
    for(int i = mid + 2; i <= r; i++){
        table[mid + 1][i] = Secret(table[mid + 1][i - 1], table[i][i]);
    }
    divide(l, mid);
    divide(mid + 1, r);
}

void Init(int N, int A[]) {
  for(int i = 0; i < N; i++)
    table[i][i] = A[i];
  divide(0, N - 1);
}

int q(int st, int dr, int l, int r){
    int mid = (st + dr) / 2;
    if(l <= mid && mid + 1 <= r){
        return Secret(table[l][mid], table[mid + 1][r]);
    }
    if(r <= mid){
        return q(st, mid, l, r);
    }
    if(l > mid){
        return q(mid + 1, dr, l, r);
    }
}

int Query(int L, int R) {
    return q(0, N - 1, L, R);
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:52:17: error: 'N' was not declared in this scope
   52 |     return q(0, N - 1, L, R);
      |                 ^
secret.cpp: In function 'int q(int, int, int, int)':
secret.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^