제출 #863105

#제출 시각아이디문제언어결과실행 시간메모리
863105maks007콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include "bits/stdc++.h"
#include "grader.cpp"
 
using namespace std;
 
string guess_sequence(int n) {
	string str = "", abxy, forPress;
	if(press("AB")) {
		if(press("A")) {
			str = "A";
			abxy = "BXY";
		}else {
			str = "B";
			abxy = "AXY";
		}
	}else {
		if(press("X")) {
			str = "X";
			abxy = "ABY";
		}else {
			str = "Y";
			abxy = "ABX";
		}
	}
	if(str.size() == n) return str;
	while(1) {
		if(str.size() == n - 1) break;
		forPress = "";
		forPress += str + abxy[0];
		forPress += str + abxy[1] + abxy[0] + str + abxy[1] + abxy[1] + str + abxy[1] + abxy[2];
		int cnt = press(forPress);
		if(cnt == str.size() + 1) str += abxy[0];
		else if(cnt == str.size() + 2) str += abxy[1];
		else str += abxy[2];
	}
	if(press(str + abxy[0]) == n) str += abxy[0];
	else if(press(str + abxy[1]) == n) str += abxy[1];
	else str += abxy[2];
	return str;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |  if(str.size() == n) return str;
      |     ~~~~~~~~~~~^~~~
combo.cpp:28:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   if(str.size() == n - 1) break;
      |      ~~~~~~~~~~~^~~~~~~~
combo.cpp:33:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if(cnt == str.size() + 1) str += abxy[0];
      |      ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:34:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   else if(cnt == str.size() + 2) str += abxy[1];
      |           ~~~~^~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccw7usAj.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/cc8lvvIl.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccw7usAj.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8lvvIl.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status