제출 #1194588

#제출 시각아이디문제언어결과실행 시간메모리
1194588ahmetlbktd4콤보 (IOI18_combo)C++20
컴파일 에러
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 la;	
	}
	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 q = press(s);
	if (q == n){
		return s;
	}
	la:p[2]++;goto lab;
}

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

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