Submission #493052

#TimeUsernameProblemLanguageResultExecution timeMemory
493052_adisCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
/*input

*/
/*inhuman strength
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,avx2")
*/
#include<bits/stdc++.h>
#include "combo.h"
#define foR(i,a,b) for(int i=a;i<=b;i++)
#define roF(i,a,b) for(int i=a;i>=b;i--)
#define _ff exit(0);
#define Sort(i,a,b) sort(i+a,i+a+b)
#define SORT(i,a,b) sort(i+a,i+a+b,greater<int>())
#define code_chef for(int i=1,x=0;i<=100000;i++){x++;cerr<<x;}
#define TLE cerr<<"\n" <<  1.0*clock()/CLOCKS_PER_SEC << "\n";
#define F first
#define S second
#define sperm(a) next_permutation(a.begin(),a.end());
#define all(a) a.begin(),a.end()
#define nxhieu_speed cin.tie(0)->sync_with_stdio(false);
#define i2 pair<int,int>
#define getbit(x,i) ((x>>(i))&1)
#define batbit(x,i) (x|(1ll<<(i)))
#define tatbit(x,i) (x&~(1<<(i)))
#define RTE cout<<-1;_ff
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r) {return l + rng() % (r - l + 1);}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
struct Triple
{
	int Fi;
	int Se;
	int Th;
};
bool operator >(Triple A, Triple B)
{
	if (A.Fi == B.Fi && A.Se == B.Se) return (A.Th > B.Th);
	if (A.Fi == B.Fi && A.Se != B.Se) return (A.Se > B.Se);
	return (A.Fi > B.Fi);
}
bool operator <(Triple A, Triple B)
{
	if (A.Fi == B.Fi && A.Se == B.Se) return (A.Th < B.Th);
	if (A.Fi == B.Fi && A.Se != B.Se) return (A.Se < B.Se);
	return (A.Fi < B.Fi);
}
bool operator ==(Triple A, Triple B)
{
	return (A.Fi == B.Fi && A.Se == B.Se && A.Th == B.Th);
}
int Money;
string guess_sequence(int N)
{
	string s;
	cout << "AB" << '\n';
	cout.flush();
	vector<char> S;
	cin >> Money;
	if (Money == 1)
	{
		cout << "A";
		cout.flush();
		cin >> Money;
		if (Money == 1)
		{
			S.push_back('B');
			S.push_back('X');
			S.push_back('Y');
			s = s + 'A';
		}
		else
		{
			S.push_back('A');
			S.push_back('X');
			S.push_back('Y');
			s = s + 'B';
		}
	}
	else {
		cout << 'X';
		cout.flush();
		cin >> Money;
		if (Money == 1)
		{
			s = s + 'X';
			S.push_back('B');
			S.push_back('A');
			S.push_back('Y');
		}
		else
		{
			s = s + 'Y';
			S.push_back('B');
			S.push_back('X');
			S.push_back('A');
		}
	}
	for (int i = 1; i < n; ++i)
	{
		cout << s << S[0] << s << S[1] << S[0] << s << S[1] << S[1] << s << S[1] << S[2] << '\n';
		cout.flush();
		cin >> Money;
		if(Money==s.size()+1) s=s+S[0];
		else if(Money==s.size()+2) s=s+S[1];
		else s=s+S[2]; 
	}
	return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:101:22: error: 'n' was not declared in this scope
  101 |  for (int i = 1; i < n; ++i)
      |                      ^
combo.cpp:106:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  106 |   if(Money==s.size()+1) s=s+S[0];
      |      ~~~~~^~~~~~~~~~~~
combo.cpp:107:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  107 |   else if(Money==s.size()+2) s=s+S[1];
      |           ~~~~~^~~~~~~~~~~~