제출 #348298

#제출 시각아이디문제언어결과실행 시간메모리
348298Halogen콤보 (IOI18_combo)C++14
10 / 100
71 ms428 KiB
#include "combo.h"

std::string guess_sequence(int N) {
	char lst[4] = {'A', 'B', 'X', 'Y'};
  	std::string p = "";
    int first = 4;

	for (int j = 0; j < N; j++) {
		bool check = false;
		for (int i = 0; i < 4; ++i) {
      if (i == first) continue;
			if (press(p + lst[i]) != p.size() + 1) continue;
			check = true;
      if (j == 0) first = i;
			p += lst[i];
			break;
  		}
		
		if (!check) return p;
	}

	return p;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |    if (press(p + lst[i]) != p.size() + 1) continue;
      |        ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...