Submission #203875

#TimeUsernameProblemLanguageResultExecution timeMemory
203875staniewzkiCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#include "combo.h"
string let = "ABXY";
string conv(basic_string<int> a) {
	string str;
	for(int x : a)
		str += let[x];
	return str;
}
int query(basic_string<int> a) {
	return press(conv(a));
}
string guess_sequence(int n) {
	int f = -1;
	if(query({0, 1})) f = (query({0}) ? 0 : 1);
	else f = (query({2}) ? 2 : 3);
	swap(let[f], let[3]);
	basic_string<int> cur = {3};
	FOR(i, 1, n - 2) {
	for(int i = 1; i <= n - 2; i++) {
		auto g = cur + 2 + 0 + cur + 2 + 1 + cur + 2 + 2 + cur + 1;
		cur += query(g) - i;
	}
	if(query(cur + 0)) cur += 0;
	else if(query(cur + 1)) cur += 1;
	else cur += 2;
	return conv(cur);
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:6: error: 'i' was not declared in this scope
   20 |  FOR(i, 1, n - 2) {
      |      ^
combo.cpp:20:2: error: 'FOR' was not declared in this scope
   20 |  FOR(i, 1, n - 2) {
      |  ^~~
combo.cpp:29:1: error: expected '}' at end of input
   29 | }
      | ^
combo.cpp:14:30: note: to match this '{'
   14 | string guess_sequence(int n) {
      |                              ^
combo.cpp:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^