Submission #1194590

#TimeUsernameProblemLanguageResultExecution timeMemory
1194590ahmetlbktd4Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int n){
	string s = "";
	int p[3] = {0,1,2};
	lab:if (p[0] > 3){
		return "";
	}	
	for (int i = 2;i > 0;i--){
		if (p[i] > 3){
			p[i] = 1;p[i-1]++;goto lab;
		}
	}
	for (int i = 1;i < 3;i++){
		if (p[i] == p[0])
		goto label;	
	}
	for (int i = 0;i < 3;i++){
		if (p[i] == 0)
		s+="A";
		if (p[i] == 1)
		s+="B";
		if (p[i] == 2)
		s+="X";
		if (p[i] == 3)
		s+="Y";
	}
	int h = press(s);
	if (h == n){
		return s;
	}
	label:p[2]++;goto lab;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:9: error: jump to label 'label'
   34 |         label:p[2]++;goto lab;
      |         ^~~~~
combo.cpp:18:22: note:   from here
   18 |                 goto label;
      |                      ^~~~~
combo.cpp:30:13: note:   crosses initialization of 'int h'
   30 |         int h = press(s);
      |             ^