Submission #919580

#TimeUsernameProblemLanguageResultExecution timeMemory
919580Khanhcsp2Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> #define el '\n' #define fi first #define sc second //#define int long long using namespace std; using ll=long long; using ull=unsigned long long; using ld=long double; const int mod=1e9+7; const int N=1e5+11; string guess_sequence(int n) { string s="ABXY", ans=""; int ch, pos; ch=guess_sequence("AB"); if(ch) { int v=guess_sequence("A"); if(v) pos=0; else pos=1; } else { int v=guess_sequence("X"); if(v) pos=2; else pos=3; } ans+=s[pos]; swap(s[pos], s[3]); for(int i=1;i<n;i++) { int tmp=ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]; int l=guess_sequence(tmp); if(l==i+2) ans+=s[0]; else if(l==i+1) ans+=s[1]; else ans+=s[2]; } if(guess_sequence(ans+s[0])==n) return ans+s[0]; else if(guess_sequence(ans+s[1])==n) return ans+s[1]; else return ans+s[2]; } //void sol() //{ // //} //signed main() //{ //// freopen("task.INP", "r", stdin); //// freopen("task.OUT", "w", stdout); // ios_base::sync_with_stdio(0); // cin.tie(0); // int t=1; // //cin >> t; // while(t--) // { // sol(); // } //}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:23: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   17 |     ch=guess_sequence("AB");
      |                       ^~~~
      |                       |
      |                       const char*
combo.cpp:13:27: note:   initializing argument 1 of 'std::string guess_sequence(int)'
   13 | string guess_sequence(int n)
      |                       ~~~~^
combo.cpp:17:22: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in assignment
   17 |     ch=guess_sequence("AB");
      |        ~~~~~~~~~~~~~~^~~~~~
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:20:30: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   20 |         int v=guess_sequence("A");
      |                              ^~~
      |                              |
      |                              const char*
combo.cpp:13:27: note:   initializing argument 1 of 'std::string guess_sequence(int)'
   13 | string guess_sequence(int n)
      |                       ~~~~^
combo.cpp:20:29: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
   20 |         int v=guess_sequence("A");
      |               ~~~~~~~~~~~~~~^~~~~
      |                             |
      |                             std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:26:30: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   26 |         int v=guess_sequence("X");
      |                              ^~~
      |                              |
      |                              const char*
combo.cpp:13:27: note:   initializing argument 1 of 'std::string guess_sequence(int)'
   13 | string guess_sequence(int n)
      |                       ~~~~^
combo.cpp:26:29: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
   26 |         int v=guess_sequence("X");
      |               ~~~~~~~~~~~~~~^~~~~
      |                             |
      |                             std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:34:62: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int' in initialization
   34 |         int tmp=ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1];
combo.cpp:35:29: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
   35 |         int l=guess_sequence(tmp);
      |               ~~~~~~~~~~~~~~^~~~~
      |                             |
      |                             std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:40:26: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int'
   40 |     if(guess_sequence(ans+s[0])==n) return ans+s[0];
combo.cpp:13:27: note:   initializing argument 1 of 'std::string guess_sequence(int)'
   13 | string guess_sequence(int n)
      |                       ~~~~^
combo.cpp:41:31: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int'
   41 |     else if(guess_sequence(ans+s[1])==n) return ans+s[1];
combo.cpp:13:27: note:   initializing argument 1 of 'std::string guess_sequence(int)'
   13 | string guess_sequence(int n)
      |                       ~~~~^
combo.cpp:15:14: warning: control reaches end of non-void function [-Wreturn-type]
   15 |     string s="ABXY", ans="";
      |              ^~~~~~