Submission #986854

#TimeUsernameProblemLanguageResultExecution timeMemory
986854TsaganaCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h"
#include<bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define F first
#define S second

using namespace std;

string guess_sequence(int N) {
  string S;
  string opt;
  if (press("AB")) {
    if (press("A")) {S = "A"; opt = "BXY";}
    else {S = "B"; opt = "AXY";}
  } else {
    if (press("X")) {S = "X"; opt = "ABY";}
    else {S = "Y"; opt = "ABX";}
  }
  if (N == 1) return S;
 
  for(int i=1;i<N-1;i++) {
    string tmp = S+opt[0]+opt[0] + S+opt[0]+opt[1] + S+opt[0]+opt[2] + S+opt[1];
    int ct = press(tmp);
    if(ct==i+2) S += opt[0];
    else if(ct==i+1) S += opt[1];
    else S += opt[2];
  }
  if (press(S + opt[0]) == N) {S += opt[0];
  else if (press(S + opt[1]) == N) S += opt[1];
  else S += opt[2];
  return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:3: error: expected '}' before 'else'
   35 |   else if (press(S + opt[1]) == N) S += opt[1];
      |   ^~~~
combo.cpp:34:31: note: to match this '{'
   34 |   if (press(S + opt[0]) == N) {S += opt[0];
      |                               ^