답안 #898685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
898685 2024-01-05T02:51:04 Z Darren0724 Minerals (JOI19_minerals) C++17
컴파일 오류
0 ms 0 KB
#include "minerals.h"
#include <bits/stdc++.h>
#include "grader.cpp"
using namespace std;
//Query(int)
//Answer(int,int)
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;
	int now=0;
	for(int i=m;i<n;i++){
		now=Query(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++){
		int t=Query(b[i]);
		if(t==now){
			b1.push_back(b[i]);
		}
		else{
			b2.push_back(b[i]);
		}
		now=t;
	}
	for(int j:b1){
		Query(j);
	}
	dc(a1,b1);
	dc(b2,a2);
}
void Solve(int n) {
	int now=0;
	vector<int> a,b;
	for(int i=1;i<=n*2;i++){
		int t=Query(i);
		if(t==now){
			b.push_back(i);
			Query(i);
		}
		else{
			a.push_back(i);
		}
		now=t;
	}
	dc(a,b);
}

Compilation message

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