Submission #1353679

#TimeUsernameProblemLanguageResultExecution timeMemory
1353679muhammad-ahmadMinerals (JOI19_minerals)C++20
Compilation error
0 ms0 KiB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

void solve(vector<int> A, vector<int> B){
	if (A.empty()) return;
	if (A.size() == 1){
		Answer(A[0], B[0]);
		return;
	}
	int mid = A.size() / 2;
	vector<int> A1(A.begin(), A.begin() + mid), A2(A.begin() + mid, A.end());
	vector<int> B1, B2;
	int bef = 0;
	for (auto i : A1){
		bef = Query(i);
	}
	for (auto i : B){
		int now = Query(i);
		if (now == bef) B1.push_back(i);
		else B2.push_back(i);
		Query(i);
	}
	
	for (auto i : A1) Query(i);
	solve(A1, B1);
	solve(A2, B2);
}

void Solve(int N){
	vector<int> A, B;
	
	int lst = 0;
	
	for (int i = 1; i <= 2 * N; i++){
		int x = Query(i);
		if (x > lst){
			A.push_back(i);
		}
		else {
			B.push_back(i);
		}
		lst = x;
	}
	for (int i = 1; i <= 2 * N; i++) query(i);
}
	solve(A, B);
}

Compilation message (stderr)

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:45:42: error: 'query' was not declared in this scope; did you mean 'Query'?
   45 |         for (int i = 1; i <= 2 * N; i++) query(i);
      |                                          ^~~~~
      |                                          Query
minerals.cpp: At global scope:
minerals.cpp:47:14: error: expected constructor, destructor, or type conversion before '(' token
   47 |         solve(A, B);
      |              ^
minerals.cpp:48:1: error: expected declaration before '}' token
   48 | }
      | ^