Submission #101769

#TimeUsernameProblemLanguageResultExecution timeMemory
101769polarzCombo (IOI18_combo)C++14
0 / 100
1 ms420 KiB
#include <bits/stdc++.h>
#include "combo.h"
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
#define INF 2147483647
using namespace std;
string meow = "XYAB";

string guess_sequence(int n){
	string s;
	int t1 = press("AB");
	if(t1 == 1){
		t1 = press("A");
		if(t1 == 1)s = "A";
		else s = "B";
	}else{
		t1 = press("X");
		if(t1 == 1)s = "X";
		else s = "Y";
	}
	string p;
	for(int i = 0; i < 4; i++){
		if(meow[i] != s[0])p += meow[i];
	}
	for(int i = 2; i <= n-1; i++){
		t1 = press(s+p[0]+s+p[1]+p[0]+s+p[1]+p[1]+s+p[1]+p[2]);
		if(t1 == i)s += p[0];
		else if(t1 == i+1)s += p[1];
		else s += p[2];
	}
	t1 = press(s+p[0]+s+p[1]);
	if(t1 == n){
		t1 = press(s+p[0]);
		if(t1 == 1)s += p[0];
		else s += p[1];
	}else{
		s += p[2];
	}
  assert(s.size() == n);
	return s;
}

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:1:
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |   assert(s.size() == n);
      |          ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...