Submission #169017

#TimeUsernameProblemLanguageResultExecution timeMemory
169017salil03Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
//OPTIMIZATIONS #pragma GCC optimize("O3") //(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS) //#pragma comment(linker, "/stack:200000000") //(UNCOMMENT WHEN NEEDED) //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native") //OPTIMIZATIONS #include <bits/stdc++.h> #include<combo.h> typedef long long ll; typedef unsigned long long uu; typedef long long int lll; typedef unsigned long long int uuu; using namespace std; #define watch(x) cerr << "\n" \ << (#x) << " is " << (x) << endl #define cel(x, y) 1 + ((x - 1) / y) const double PI = 3.141592653589793238463; const int MOD = 1000000007; const int INF = 0x3f3f3f3f; /* $alil03 URL: url Solution Begins here */ string guess_sequence(int n) { char first = 'A'; if(press('A') == 1) { first = 'A'; } else if(press('B') == 1) { first = 'B' } else if(press('X') == 1) { first = 'X' } else if(press('Y') == 1) { first = 'Y' } int temp = n; n--; string s = "ABXY"; string ans = ""; ans += first; while(n--) { for(int i = 0; i<4; i++) { if(s[i] == first) { continue; } if(press(ans + s[i]) == temp-n) { ans += s[i]; break; } } } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:11: error: could not convert ''A'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   35 |  if(press('A') == 1)
      |           ^~~
      |           |
      |           char
combo.cpp:39:16: error: could not convert ''B'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   39 |  else if(press('B') == 1)
      |                ^~~
      |                |
      |                char
combo.cpp:41:14: error: expected ';' before '}' token
   41 |   first = 'B'
      |              ^
      |              ;
   42 |  }
      |  ~            
combo.cpp:43:16: error: could not convert ''X'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   43 |  else if(press('X') == 1)
      |                ^~~
      |                |
      |                char
combo.cpp:45:14: error: expected ';' before '}' token
   45 |   first = 'X'
      |              ^
      |              ;
   46 |  }
      |  ~            
combo.cpp:47:19: error: could not convert ''Y'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   47 |     else if(press('Y') == 1)
      |                   ^~~
      |                   |
      |                   char
combo.cpp:49:14: error: expected ';' before '}' token
   49 |   first = 'Y'
      |              ^
      |              ;
   50 |  }
      |  ~