제출 #383682

#제출 시각아이디문제언어결과실행 시간메모리
383682wlh_code콤보 (IOI18_combo)C++17
10 / 100
55 ms540 KiB
#include "combo.h"
using namespace std;
string guess_sequence (int N) {
	string keys = "ABXY"; string s;
	for (int i = 0; i < 4; ++i) {
		string t; t += keys[i];
		if (press(t)) {
			s += keys[i];
			keys.erase(keys.begin() + i);
			break;
		}
	}
	for (int i = 1; i < N; ++i) {
		for (int j = 0; j < 2; ++j) {
			string t = s; t += keys[j];
			if (press(t) > i) {
				s += keys[j];
				break;
			}
		}
		if (s.length() == i) s += keys[2];
	}
	return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |   if (s.length() == i) s += keys[2];
      |       ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...