제출 #139629

#제출 시각아이디문제언어결과실행 시간메모리
139629bazsi700콤보 (IOI18_combo)C++14
5 / 100
3066 ms340 KiB
#include <bits/stdc++.h>
#include <combo.h>
using namespace std;

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL
#define hashA 1257958787
#define hashB 1539500609
#define endl "\n"

int press(string s);

string guess_sequence(int n) {
	char st;
	vector<char> chs;
	if(press("AB")) {
		if(press("A")) {
			st = 'A';
			chs = {'B','X','Y'};
		} else {
			st = 'B';
			chs = {'A','X','Y'};
		}
	} else {
		if(press("X")) {
			st = 'X';
			chs = {'A','B','Y'};
		} else {
			st = 'Y';
			chs = {'A','B','X'};
		}
	}
	string currs = "";
	currs+= st;
	for(int i = 2; i < n; i++) {
		string ask = currs;
		ask+= chs[0];
		ask+= currs;
		ask+= chs[1];
		ask+= chs[0];
		ask+= currs;
		ask+= chs[1];
		ask+= chs[1];
		ask+= currs;
		ask+= chs[1];
		ask+= chs[2];
		int x = press(ask);
		if(x == i-1) {
			currs+= chs[2];
		} else if(x == i) {
			currs+= chs[0];
		} else {
			currs+= chs[1];
		}
	}
	string ask = currs;
	ask+= chs[0];
	if(press(ask) == n) {
		currs+= chs[0];
	} else {
		string askk = currs;
		askk+= chs[1];
		if(press(askk) == n) {
			currs+= chs[1];
		} else {
			currs+= chs[2];
		}
	}
	if(currs.length() != n) {
		while(true) {}
	}
	return currs;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:73:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   73 |  if(currs.length() != n) {
      |     ~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...