답안 #418541

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418541 2021-06-05T13:21:59 Z fvogel499 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
/*
File created on 06/05/2021 at 15:10:35.
Link to problem: 
Description: 
Time complexity: O()
Space complexity: O()
Status: DEV
Copyright: Ⓒ 2021 Francois Vogel
*/

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <queue>
#include <cstring>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>

#include "secret.h"

using namespace std;

#define pii pair<int, int>
#define f first
#define s second

#define pb push_back
#define ins insert
#define cls clear

#define ll long long

int b [1000][1000];
int a [1000];
int n;

void bs(int start, int end) {
    if (start > end) return;
    int mid = (start+end)/2;
    b[mid][mid] = a[mid];
    for (int i = mid-1; i >= start; i--) {
        b[i][mid] = Secret(b[i+1][mid], a[i]);
    }
    if (start >= end) return;
    b[mid+1][mid+1] = a[mid+1];
    for (int i = mid+2; i < end; i++) {
        b[mid+1][i] = Secret(b[mid+1][i-1], a[i]);
    }
    bs(start, mid-1);
    bs(mid+1, end);
}

void Init(int ln, int la []) {
    n = ln;
    for (int i = 0; i < n; i++) a[i] = la[i];
    bs(a, 0, n-1);
}

int Query(int queryLeft, int queryRight) {
    if (queryLeft == queryRight) {
        return a[queryLeft];
    }
    int start = 0;
    int end = n-1;
    while (true) {
        int mid = (start+end)/2;
        if (queryLeft <= mid and mid < queryRight) {
            int res = Secret(b[queryLeft][mid], b[mid+1][queryRight]);
            return res;
        }
        if (queryRight < mid) end = mid-1;
        else start = mid+1;
    }
}

// signed main() {
//     cin.tie(0);
//     // ios_base::sync_with_stdio(0);

//     int d = 0;
//     d++;
// }

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:60:8: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   60 |     bs(a, 0, n-1);
      |        ^
      |        |
      |        int*
secret.cpp:60:17: error: too many arguments to function 'void bs(int, int)'
   60 |     bs(a, 0, n-1);
      |                 ^
secret.cpp:41:6: note: declared here
   41 | void bs(int start, int end) {
      |      ^~