Submission #1311184

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

string guess_sequence(int N) {
	
	int ok=0;
	ok=press("AB");
	if (ok==1){
		ok=press("A");
		if (ok==1) s="A"; else s="B";
	}	
	else{
		ok=press("X");
		if (ok==1) s="X"; else s="Y";
	}
	
	string st='ABXY';
	string p="";
	for (int i=0; i<4; i++){
		if (st[i]!=s[0]) p+=st[i];
	}
	int k=1;
	while (k<N){
		
		st=s; st+=p[0];
		st+=s+p[1]+p[0]; st+=s+p[1]+p[1]; st+=s+p[1]+p[2];
		ok=press(st);
		if (ok==k){
			k++; s+=p[2]; continue;
		}
		if (ok==k+1){
			k++; s+=p[0]; continue;
		}
		k++; s+=p[1];
		
		
	}

 	return s;
}

Compilation message (stderr)

combo.cpp:18:19: warning: multi-character character constant [-Wmultichar]
   18 |         string st='ABXY';
      |                   ^~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:28: error: 's' was not declared in this scope
   11 |                 if (ok==1) s="A"; else s="B";
      |                            ^
combo.cpp:11:40: error: 's' was not declared in this scope
   11 |                 if (ok==1) s="A"; else s="B";
      |                                        ^
combo.cpp:15:28: error: 's' was not declared in this scope
   15 |                 if (ok==1) s="X"; else s="Y";
      |                            ^
combo.cpp:15:40: error: 's' was not declared in this scope
   15 |                 if (ok==1) s="X"; else s="Y";
      |                                        ^
combo.cpp:18:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   18 |         string st='ABXY';
      |                   ^~~~~~
combo.cpp:21:28: error: 's' was not declared in this scope
   21 |                 if (st[i]!=s[0]) p+=st[i];
      |                            ^
combo.cpp:26:20: error: 's' was not declared in this scope
   26 |                 st=s; st+=p[0];
      |                    ^
combo.cpp:40:16: error: 's' was not declared in this scope
   40 |         return s;
      |                ^