답안 #764199

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
764199 2023-06-23T08:32:54 Z Dan4Life Minerals (JOI19_minerals) C++17
컴파일 오류
0 ms 0 KB
//#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
int n;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void dnc(vector<int> l, vector<int> r){
    if(sz(l)<1) return;
    if(sz(l)==1) return void(Answer(l[0],r[0]));
    int mid = sz(l)/2, x, tot;
    vector<int> v[2],w[2]; 
    for(int i : {0,1}) v[i].clear(),w[i].clear(); 
    for(int i = 0; i < mid; i++) tot=Query(l[i]);
    for(int i = 0; i < sz(l); i++) v[i>=mid].pb(l[i]);
    for(int i : r) x = Query(i), w[x!=tot].pb(i), Query(i);
    for(int i = 0; i < mid; i++) Query(l[i]);
    dnc(v[0],w[0]),dnc(v[1],w[1]);
}

void Solve(int N) {
    n = N;
    vector<int> v(2*n,0),w[2];
    iota(all(v),1); shuffle(all(v),rng);
    for(int i = 0; i < sz(v); i++) w[i<n].pb(v[i]);
    dnc(w[0],w[1]);
}

Compilation message

minerals.cpp: In function 'void dnc(std::vector<int>, std::vector<int>)':
minerals.cpp:12:30: error: 'Answer' was not declared in this scope
   12 |     if(sz(l)==1) return void(Answer(l[0],r[0]));
      |                              ^~~~~~
minerals.cpp:16:38: error: 'Query' was not declared in this scope
   16 |     for(int i = 0; i < mid; i++) tot=Query(l[i]);
      |                                      ^~~~~
minerals.cpp:18:24: error: 'Query' was not declared in this scope
   18 |     for(int i : r) x = Query(i), w[x!=tot].pb(i), Query(i);
      |                        ^~~~~
minerals.cpp:19:34: error: 'Query' was not declared in this scope
   19 |     for(int i = 0; i < mid; i++) Query(l[i]);
      |                                  ^~~~~