Submission #85520

# Submission time Handle Problem Language Result Execution time Memory
85520 2018-11-20T16:40:36 Z JustasLe Combo (IOI18_combo) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence(int N) {
	string ans = "";
	string poss = "ABXY";
	for (int i = 0; i < 4; i++) {
		string temp = "" + poss[i];
		int cnt = press(temp);
		if (cnt > 0) {
			poss.erase(poss.begin() + i);
			ans += temp;
			break;
		}
	}
	if(N == 1) {
		return ans;
	}
	bool ok = true;
	int prev = 1;
	while (ok && (int) ans.Size() < N) {
		ok = false;
		for (int i = 0; i < 3; i++) {
			string newAns = ans + "" + poss[i];
			int cnt = press(newAns);
			if(cnt > prev) {
				ans = newAns;
				ok = true;
				prev = cnt;
				break;
			}
		}
	}
	return ans;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:25: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'Size'; did you mean 'size'?
   23 |  while (ok && (int) ans.Size() < N) {
      |                         ^~~~
      |                         size