Submission #901273

# Submission time Handle Problem Language Result Execution time Memory
901273 2024-01-09T08:34:49 Z Darren0724 Minerals (JOI19_minerals) C++17
Compilation error
0 ms 0 KB
#include "minerals.h"
#include <bits/stdc++.h>
#include "grader.cpp"
using namespace std;
//Query(int)
//Answer(int,int)
int last=0;
int ask(int k){
	int p = Query(k);
	int tmp = p - last;
	last = p;
	return tmp; 
}
void dc(vector<int> &a,vector<int> &b){
	int n=a.size();
	if(n==1){
		Answer(a[0],b[0]);
		return;
	}
	int m=n/2;
	for(int i=m;i<n;i++){
		ask(a[i]);
	}
	vector<int> a1,a2,b1,b2;
	for(int i=0;i<m;i++){
		a1.push_back(a[i]);
	}
	for(int i=m;i<n;i++){
		a2.push_back(a[i]);
	}
	for(int i=0;i<n;i++){
		if(ask(b[i])==0){
			b1.push_back(b[i]);
		}
		else{
			b2.push_back(b[i]);
		}
	}
	dc(a1,b1);
	dc(b2,a2);
}
void Solve(int n) {
	vector<int> a,b;
	for(int i=1;i<=n*2;i++){
		if(ask(i)==0){
			b.push_back(i);
		}
		else{
			a.push_back(i);
		}
	}
	for(int i:b){
		ask(i);
	}
	dc(a,b);
}

Compilation message

/usr/bin/ld: /tmp/ccZ096ho.o: in function `Query(int)':
grader.cpp:(.text+0x30): multiple definition of `Query(int)'; /tmp/ccpNGF6p.o:minerals.cpp:(.text+0x30): first defined here
/usr/bin/ld: /tmp/ccZ096ho.o: in function `Answer(int, int)':
grader.cpp:(.text+0x100): multiple definition of `Answer(int, int)'; /tmp/ccpNGF6p.o:minerals.cpp:(.text+0x100): first defined here
/usr/bin/ld: /tmp/ccZ096ho.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccpNGF6p.o:minerals.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status