Submission #983619

#TimeUsernameProblemLanguageResultExecution timeMemory
983619SzymonKrzywdaCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <string> #include "combo.h" using namespace std; string guess_sequence(int N){ int k; char literka; string wynik="",query; if (press("AB")){ if (press("A")){ literka = 'A'; } else{ literka = 'B'; } } else{ if (press("X")){ literka = 'X'; } else{ literka = 'Y'; } } wynik += literka; string li_1="",li_2="",li_3=""; for (auto i: "ABXY"){ if (i==literka) continue; if(li_1=="") li_1 = i; else if (li_2=="") li_2 = i; else if (li_3=="") li_3 = i; } cout << li_1 << " " << li_2 << " " << li_3 << endl; for (int i=2; i<N; i++){ query = wynik+li_1+wynik+li_2+li_1+wynik+li_2+li_2+wynik+li_2+li_3; k = press(query); if (k-i+1 == 1){ wynik += li_1; } else if(k-i+1 == 2){ wynik += li_2; } else wynik += li_3; } if (N!=1){ if (press(wynik+"AB")==N){ if (press(wynik+"A")==N){ literka = 'A'; } else{ literka = 'B'; } } else{ if (press(wynik+"X")==N){ literka = 'X'; } else{ literka = 'Y'; } } wynik += literka; } return wynik; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:5: error: 'cout' was not declared in this scope
   34 |     cout << li_1 << " " << li_2 << " " << li_3 << endl;
      |     ^~~~
combo.cpp:3:1: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    2 | #include "combo.h"
  +++ |+#include <iostream>
    3 | using namespace std;
combo.cpp:34:51: error: 'endl' was not declared in this scope
   34 |     cout << li_1 << " " << li_2 << " " << li_3 << endl;
      |                                                   ^~~~
combo.cpp:3:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
    2 | #include "combo.h"
  +++ |+#include <ostream>
    3 | using namespace std;