답안 #244079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244079 2020-07-02T14:47:43 Z minhcool 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
//#include "secret.h"
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define ins insert
#define er erase
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
 
//const int oo = 1e18 + 7, mod = 1e9 + 7;
 
int n, x, y, a[1005], ans[1005][1005], answer, c[1005];
 
void build(int l, int r){
    if(r <= (l + 1)) return;
    int mid = (l + r) >> 1;
    for(int i = mid - 1; i >= l; i--) ans[i][mid] = Secret(ans[i + 1][mid], a[i]);
    for(int i = mid + 2; i <= r; i++) ans[mid + 1][i] = Secret(ans[mid + 1][i - 1], a[i]);
    build(l, mid);
    build(mid + 1, r);
}
 
void search(int l, int r){
    int mid = (l + r) >> 1;
    if(x < mid || y > mid) return;
    if(x <= mid && y > mid){
        answer = Secret(ans[x][mid], ans[mid + 1][y]);
        return;
    }
    search(l, mid);
    search(mid + 1, r);
}
 
void Init(int N, int A[]){
    n = N;
    for(int i = 0; i < n; i++) a[i + 1] = A[i];
    build(1, n);
}
 
int Query(int X, int Y){
    x = X;
    y = Y;
    if(x == y) return a[x];
    else if(x == (y - 1)) return Secret(a[x], a[x + 1]);
    answer = 0;
    search(1, n);
    return answer;
}

/*
TEST HERE
INPUT #1
 
OUTPUT #1
 
 
INPUT #2
 
OUTPUT #2
 
 
INPUT #3
 
OUTPUT #3
 
*/

Compilation message

secret.cpp: In function 'void build(int, int)':
secret.cpp:22:53: error: 'Secret' was not declared in this scope
     for(int i = mid - 1; i >= l; i--) ans[i][mid] = Secret(ans[i + 1][mid], a[i]);
                                                     ^~~~~~
secret.cpp:22:53: note: suggested alternative: 'qecvt'
     for(int i = mid - 1; i >= l; i--) ans[i][mid] = Secret(ans[i + 1][mid], a[i]);
                                                     ^~~~~~
                                                     qecvt
secret.cpp:23:57: error: 'Secret' was not declared in this scope
     for(int i = mid + 2; i <= r; i++) ans[mid + 1][i] = Secret(ans[mid + 1][i - 1], a[i]);
                                                         ^~~~~~
secret.cpp:23:57: note: suggested alternative: 'qecvt'
     for(int i = mid + 2; i <= r; i++) ans[mid + 1][i] = Secret(ans[mid + 1][i - 1], a[i]);
                                                         ^~~~~~
                                                         qecvt
secret.cpp: In function 'void search(int, int)':
secret.cpp:32:18: error: 'Secret' was not declared in this scope
         answer = Secret(ans[x][mid], ans[mid + 1][y]);
                  ^~~~~~
secret.cpp:32:18: note: suggested alternative: 'qecvt'
         answer = Secret(ans[x][mid], ans[mid + 1][y]);
                  ^~~~~~
                  qecvt
secret.cpp: In function 'int Query(int, int)':
secret.cpp:49:34: error: 'Secret' was not declared in this scope
     else if(x == (y - 1)) return Secret(a[x], a[x + 1]);
                                  ^~~~~~
secret.cpp:49:34: note: suggested alternative: 'qecvt'
     else if(x == (y - 1)) return Secret(a[x], a[x + 1]);
                                  ^~~~~~
                                  qecvt