Submission #290016

#TimeUsernameProblemLanguageResultExecution timeMemory
290016TangentCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"


using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(), order_of_key()

typedef long long ll;
typedef long double dd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<dd, dd> pdd;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<dd> vdd;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vdd> vvdd;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
typedef vector<vpdd> vvpdd;
typedef vector<bool> vb;

const int inf = 1 << 30;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define ffor(i, a, b) for(ll i = a; i < b; i++)
#define forin(x, a) for (auto &x: a)
#define all(x) x.begin(), x.end()

#ifdef TEST
#define dbg(x) cout << #x << ": " << x << '\n';
#define dbgc(x) cout << #x << ":"; forin(a, x) { cout << " " << a; } cout << endl;
#define tassert(x) assert(x);
#else
#define dbg(x)
#define dbgc(x)
#define tassert(x)
#endif

std::string guess_sequence_sequence(int N) {
  if (N == 1) {
  	if (guess_sequence("A")) {
  		return ("A");
  	}
  	if (guess_sequence("B")) {
  		return ("B");
  	}
  	if (guess_sequence("X")) {
  		return ("X");
  	}
  	return ("Y");
  }
  char first;
  string rem;
  if (guess_sequence("AB")) {
	  if (guess_sequence("A")) {
	  	first = 'A';
	  	rem = "BCD";
	  } else {
	  	first = 'A';
	  	rem = "BCD";
	  }
  } else {
	  if (guess_sequence("C")) {
	  	first = 'A';
	  	rem = "BCD";
	  } else {
	  	first = 'A';
	  	rem = "BCD";
	  }
  }
  string res;
  res += first;
  while (res.size() < N) {
  	if (res.size() == N - 1) {
  		if (guess_sequence(res + rem.at(0))) {
  			res += rem.at(0);
  		} else if (guess_sequence(res + rem.at(1))) {
  			res += rem.at(1);
  		} else {
  			res += rem.at(2);
  		}
  	} else {
  		int l = guess_sequence(res + rem.at(0) + res + rem.at(1) + rem.at(0) + res + rem.at(1) + rem.at(1) + res + rem.at(1) + rem.at(2));
  		if (l == res.size()) {
  			res += rem.at(2);
  		} else if (l == res.size() + 1) {
  			res += rem.at(0);
  		} else {
  			res += rem.at(1);
  		}
  	}
  }
  return res;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence_sequence(int)':
combo.cpp:51:23: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   51 |    if (guess_sequence("A")) {
      |                       ^~~
      |                       |
      |                       const char*
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:51:22: error: could not convert 'guess_sequence(int)()' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   51 |    if (guess_sequence("A")) {
      |        ~~~~~~~~~~~~~~^~~~~
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:54:23: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   54 |    if (guess_sequence("B")) {
      |                       ^~~
      |                       |
      |                       const char*
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:54:22: error: could not convert 'guess_sequence(int)()' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   54 |    if (guess_sequence("B")) {
      |        ~~~~~~~~~~~~~~^~~~~
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:57:23: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   57 |    if (guess_sequence("X")) {
      |                       ^~~
      |                       |
      |                       const char*
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:57:22: error: could not convert 'guess_sequence(int)()' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   57 |    if (guess_sequence("X")) {
      |        ~~~~~~~~~~~~~~^~~~~
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:64:22: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   64 |   if (guess_sequence("AB")) {
      |                      ^~~~
      |                      |
      |                      const char*
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:64:21: error: could not convert 'guess_sequence(int)()' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   64 |   if (guess_sequence("AB")) {
      |       ~~~~~~~~~~~~~~^~~~~~
      |                     |
      |                     std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:65:23: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   65 |    if (guess_sequence("A")) {
      |                       ^~~
      |                       |
      |                       const char*
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:65:22: error: could not convert 'guess_sequence(int)()' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   65 |    if (guess_sequence("A")) {
      |        ~~~~~~~~~~~~~~^~~~~
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:73:23: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   73 |    if (guess_sequence("C")) {
      |                       ^~~
      |                       |
      |                       const char*
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:73:22: error: could not convert 'guess_sequence(int)()' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   73 |    if (guess_sequence("C")) {
      |        ~~~~~~~~~~~~~~^~~~~
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:83:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   83 |   while (res.size() < N) {
      |          ~~~~~~~~~~~^~~
combo.cpp:84:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   84 |    if (res.size() == N - 1) {
      |        ~~~~~~~~~~~^~~~~~~~
combo.cpp:85:28: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int'
   85 |     if (guess_sequence(res + rem.at(0))) {
      |                        ~~~~^~~~~~~~~~~
      |                            |
      |                            std::__cxx11::basic_string<char>
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:87:35: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int'
   87 |     } else if (guess_sequence(res + rem.at(1))) {
      |                               ~~~~^~~~~~~~~~~
      |                                   |
      |                                   std::__cxx11::basic_string<char>
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:93:122: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int'
   93 |     int l = guess_sequence(res + rem.at(0) + res + rem.at(1) + rem.at(0) + res + rem.at(1) + rem.at(1) + res + rem.at(1) + rem.at(2));
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
      |                                                                                                                          |
      |                                                                                                                          std::__cxx11::basic_string<char>
In file included from combo.cpp:2:
combo.h:5:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |                            ~~~~^
combo.cpp:94:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   94 |     if (l == res.size()) {
      |         ~~^~~~~~~~~~~~~
combo.cpp:96:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   96 |     } else if (l == res.size() + 1) {
      |                ~~^~~~~~~~~~~~~~~~~