Submission #276021

#TimeUsernameProblemLanguageResultExecution timeMemory
276021Bill_00Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int n){ int p=press("AB"); char k; vector<char>a; a.push_back('A'); a.push_back('B'); a.push_back('X'); a.push_back('Y'); string ans; if(p==0){ p=press('X'); if(p==0){ k='Y'; } else k='X'; } else{ p=press('A'); if(p==0){ k='B'; } else k='A'; } ans+=k; for(int i=0;i<4;i++){ if(a[i]==k){ a.erase(a.begin()+i); } } for(int i=2;i<n;i++){ p=press(ans+a[0]+a[0]+ans+a[0]+a[1]+ans+a[0]+a[2]+ans+a[1]); if(p==ans.size()){ ans+=a[2]; } else{ if(p==ans.size()+1){ ans+=a[1]; } else ans+=a[0]; } } p=press(ans+'A'+ans+'B'); if(p==ans.size()){ p=press(ans+'X'); if(p==ans.size()){ return ans+'Y'; } else return ans+'X'; } else{ p=press(ans+'A'); if(p==ans.size()){ return ans+'B'; } else return ans+'A'; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:11: error: could not convert ''X'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   14 |   p=press('X');
      |           ^~~
      |           |
      |           char
combo.cpp:21:11: error: could not convert ''A'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   21 |   p=press('A');
      |           ^~~
      |           |
      |           char
combo.cpp:35:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   if(p==ans.size()){
      |      ~^~~~~~~~~~~~
combo.cpp:39:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |    if(p==ans.size()+1){
      |       ~^~~~~~~~~~~~~~
combo.cpp:46:6: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |  if(p==ans.size()){
      |     ~^~~~~~~~~~~~
combo.cpp:48:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   if(p==ans.size()){
      |      ~^~~~~~~~~~~~
combo.cpp:55:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |   if(p==ans.size()){
      |      ~^~~~~~~~~~~~