답안 #954523

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954523 2024-03-28T06:00:37 Z IBory 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
using namespace std;

map<pii, int> D;
int N;

void DnC1(int L, int R) {
    if (L >= R) return;
    int mid = (L + R) >> 1;

    for (int i = mid - 1; i >= L; --i) D[{i, mid}] = Secret(i, mid);
    for (int i = mid + 2; i <= R; ++i) D[{mid, i}] = Secret(mid, i);

    DnC1(L, mid);
    DnC1(mid + 1, R);
}

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

int DnC2(int L, int R, int s, int e) {
    if (L >= R) return -1;
    int mid = (L + R) >> 1;

    if (s <= mid && mid < e) {
        int a = D[{s, mid}], b = D[{mid + 1, e}];
        return Secret(a, b);
    }

    if (e <= mid) return DnC2(L, mid);
    else return DnC2(mid + 1, R);
}


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

Compilation message

secret.cpp: In function 'int DnC2(int, int, int, int)':
secret.cpp:35:37: error: too few arguments to function 'int DnC2(int, int, int, int)'
   35 |     if (e <= mid) return DnC2(L, mid);
      |                                     ^
secret.cpp:26:5: note: declared here
   26 | int DnC2(int L, int R, int s, int e) {
      |     ^~~~
secret.cpp:36:32: error: too few arguments to function 'int DnC2(int, int, int, int)'
   36 |     else return DnC2(mid + 1, R);
      |                                ^
secret.cpp:26:5: note: declared here
   26 | int DnC2(int L, int R, int s, int e) {
      |     ^~~~