Submission #487677

#TimeUsernameProblemLanguageResultExecution timeMemory
487677BY_KUTBILIMCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
/*
  @AUTHOR: BY_KUTBILIM
  FILE CREATED: 16.11.2021 17:32:18  (GMT+6)
*/
#include <bits/stdc++.h>
using namespace std;

#define endl      '\n'
#define sz(x)     int((x).size())
#define all(x)    (x).begin(), (x).end()
#define rall(x)   (x).rbegin(), (x).rend()
#define fi        first
#define se        second
#define pb        push_back
using ll = long long;
using pii = pair<int, int>;

string guess_sequence(int n){
	string ans;
	int i = 2, q;
	char a = 'A', b = 'B', c = 'Y';
	if(press("XY")){
		if(press("X"))res = "X";
		else res = "Y", c = 'X';
	} else{
		if(press("A"))res = "A", a = 'X';
		else res = "B", b = 'X';
	}
	for (; i < n; i++){
		q = press(res+a+res+b+a+res+b+b+res+b+c);
		if(q==i)res+=a;
		else if(q == i+1)res+=b;
		else res+=c;
	}
	if(i==n){
		if(press(res+a)==n)res+=a;
		elseif(press(res+b)==n)res+=b;
		else res+=c;
	}
	return res;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:5: error: 'press' was not declared in this scope
   22 |  if(press("XY")){
      |     ^~~~~
combo.cpp:23:17: error: 'res' was not declared in this scope
   23 |   if(press("X"))res = "X";
      |                 ^~~
combo.cpp:24:8: error: 'res' was not declared in this scope
   24 |   else res = "Y", c = 'X';
      |        ^~~
combo.cpp:26:17: error: 'res' was not declared in this scope
   26 |   if(press("A"))res = "A", a = 'X';
      |                 ^~~
combo.cpp:27:8: error: 'res' was not declared in this scope
   27 |   else res = "B", b = 'X';
      |        ^~~
combo.cpp:30:13: error: 'res' was not declared in this scope
   30 |   q = press(res+a+res+b+a+res+b+b+res+b+c);
      |             ^~~
combo.cpp:30:7: error: 'press' was not declared in this scope
   30 |   q = press(res+a+res+b+a+res+b+b+res+b+c);
      |       ^~~~~
combo.cpp:36:12: error: 'res' was not declared in this scope
   36 |   if(press(res+a)==n)res+=a;
      |            ^~~
combo.cpp:36:6: error: 'press' was not declared in this scope
   36 |   if(press(res+a)==n)res+=a;
      |      ^~~~~
combo.cpp:37:16: error: 'res' was not declared in this scope
   37 |   elseif(press(res+b)==n)res+=b;
      |                ^~~
combo.cpp:37:10: error: 'press' was not declared in this scope
   37 |   elseif(press(res+b)==n)res+=b;
      |          ^~~~~
combo.cpp:37:3: error: 'elseif' was not declared in this scope
   37 |   elseif(press(res+b)==n)res+=b;
      |   ^~~~~~
combo.cpp:38:3: error: expected '}' before 'else'
   38 |   else res+=c;
      |   ^~~~
combo.cpp:35:10: note: to match this '{'
   35 |  if(i==n){
      |          ^
combo.cpp:38:8: error: 'res' was not declared in this scope
   38 |   else res+=c;
      |        ^~~
combo.cpp:39:2: warning: no return statement in function returning non-void [-Wreturn-type]
   39 |  }
      |  ^
combo.cpp: At global scope:
combo.cpp:40:2: error: expected unqualified-id before 'return'
   40 |  return res;
      |  ^~~~~~
combo.cpp:41:1: error: expected declaration before '}' token
   41 | }
      | ^