답안 #751923

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
751923 2023-06-01T20:12:46 Z Desh03 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> mid, v;

void dc(int l, int r, vector<int> &a) {
    if (l > r) return;
    int m = l + r >> 1;
    v[m][m] = a[m];
    if (m < r) v[m + 1][m + 1] = a[m + 1];
    for (int i = l; i <= m - 1; i++)
        for (int j = m + 1; j <= r; j++)
            mid[i][j] = m;
    for (int i = m - 1; i >= l; i--)
        v[i][m] = Secret(a[i], v[i + 1][m]);
    for (int i = m + 2; i <= r; i--)
        v[m + 1][i] = Secret(a[i], v[m + 1][i - 1]);
    dc(l, m - 1);
    dc(m + 1, r);
}

void init(int n, vector<int> a) {
    mid = v = vector<vector<int>> (n, vector<int> (n, -1));
    dc(0, n - 1, a);
}

int query(int l, int r) {
    if (v[l][r] != -1) return v[l][r];
    int m = mid[l][r];
    return Secret(v[l][m], v[m + 1][r]);
}

Compilation message

secret.cpp: In function 'void dc(int, int, std::vector<int>&)':
secret.cpp:9:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    9 |     int m = l + r >> 1;
      |             ~~^~~
secret.cpp:19:16: error: too few arguments to function 'void dc(int, int, std::vector<int>&)'
   19 |     dc(l, m - 1);
      |                ^
secret.cpp:7:6: note: declared here
    7 | void dc(int l, int r, vector<int> &a) {
      |      ^~
secret.cpp:20:16: error: too few arguments to function 'void dc(int, int, std::vector<int>&)'
   20 |     dc(m + 1, r);
      |                ^
secret.cpp:7:6: note: declared here
    7 | void dc(int l, int r, vector<int> &a) {
      |      ^~