제출 #1144146

#제출 시각아이디문제언어결과실행 시간메모리
1144146crispxx콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"

#include "grader.cpp"

using namespace std;

#define all(x) x.begin(), x.end()

string guess_sequence(int n) {
	int pf = 0;
	
	string p;
	
	vector<char> F {'A', 'B', 'X'};
	
	for(auto c : F) {
		if(press(p + c) == pf + 1) {
			pf++;
			p += c;
			F.erase(find(all(F), c));
			break;
		}
	}
	
	if(!pf) {
		p += 'Y';
		pf++;
	} else {
		F.push_back('Y');
	}
	
	vector<char> S {F[0], F[1]};
	
	for(int i = 1; i < n; i++) {
		int _pf = pf;
		
		for(auto c : S) {
			if(press(p + c) == pf + 1) {
				p += c;
				pf++;
				break;
			}
		}
		
		if(_pf == pf) {
			p += F[2];
			pf++;
		}
	}
	
	return p;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/cc5uRDgZ.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccjSeyhp.o:combo.cpp:(.text+0xd0): first defined here
/usr/bin/ld: /tmp/cc5uRDgZ.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccjSeyhp.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status