답안 #744056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
744056 2023-05-18T07:43:33 Z salmon Weirdtree (RMI21_weirdtree) C++14
컴파일 오류
0 ms 0 KB
#include "weirdtree.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> lst;
priority_queue<pair<int,int>> pq;

void initialise(int N, int Q, int h[]) {
	lst.push_back(0);
	for(int i = 1; i <= N; i++){
		lst.push_back(h[i]);
	}
}

void cut(int l, int r, int k) {
    while(!pq.empty()){
        pq.pop();
    }

	for(int i = l; i <= r; i++){
        pq.push(make_pair(lst[i],-i));
	}

	while(k != 0){
        if(pq.top().first == 0){
            return;
        }
    }

    lst[-pq.top().second]--;
}
void magic(int i, int x) {
	v[i] = x;
}
long long int inspect(int l, int r) {
	long long int V = 0;

	for(int i = l ; i <= r; i++){
        V = V + lst[i];
	}

	return V;
}

Compilation message

weirdtree.cpp: In function 'void magic(int, int)':
weirdtree.cpp:32:2: error: 'v' was not declared in this scope
   32 |  v[i] = x;
      |  ^