Submission #383091

#TimeUsernameProblemLanguageResultExecution timeMemory
383091Christopher_RdzCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ char ini; if (press("AB") != 0){ if (press("A") == 1){ ini = 'A'; }else{ ini = 'B'; } }else{ if (press("X") == 1){ ini = 'X'; }else{ ini = 'Y'; } } string l; if (ini == 'A') l = "BXY"; if (ini == 'B') l = "AXY"; if (ini == 'X') l = "ABY"; if (ini == 'Y') l = "ABX"; string s = ini; int p = 1; int ans; for (int i = 2; i <= (n - 1); i++){ ans = press(s + l[0] + l[0] + s + l[0] + l[1] + s + l[0] + l[2] + s + l[1]); if ((ans - p) == 0) s += l[2]; if ((ans - p) == 1) s += l[1]; if ((ans - p) == 0) s += l[0]; p++; } if (press(s + l[0]) == n){ s += l[0]; }else{ if (press(s + l[1]) == n){ s += l[1]; }else{ s += l[2]; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   26 |     string s = ini;
      |                ^~~