Submission #349482

# Submission time Handle Problem Language Result Execution time Memory
349482 2021-01-17T16:19:42 Z David_M Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string ans;
char c, a[]={'Y', 'A', 'B'};
string guess_sequence(int N){
	if(press(string("XY")){
		if(press(string('X')))ans+='X';
		else ans+='Y';
	}else{
		if(press(string('A')))ans+='A';
		else ans+='B';
	}
	if(N==1)return ans;
	if(ans=="Y")a[0]='X';
	if(ans=="A")a[1]='X';
	if(ans=="B")a[2]='X';
	 
	for (int i=1; i<N-1; i++)ans+=a[press(ans+a[1]+ans+a[2]+a[0]+ans+a[2]+a[1]+ans+a[2]+a[2])-i];
	if(press(ans+a[0])==N)return ans+a[0];
	if(press(ans+a[1])==N)return ans+a[1];
	return ans+a[2];
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:5: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17'
    7 |  if(press(string("XY")){
      |     ^~~~~
combo.cpp:7:24: error: expected ';' before '{' token
    7 |  if(press(string("XY")){
      |                        ^
      |                        ;
combo.cpp:10:3: error: expected primary-expression before 'else'
   10 |  }else{
      |   ^~~~
combo.cpp:10:3: error: expected ')' before 'else'
   10 |  }else{
      |   ^~~~
      |   )
combo.cpp:7:4: note: to match this '('
    7 |  if(press(string("XY")){
      |    ^