Submission #331258

# Submission time Handle Problem Language Result Execution time Memory
331258 2020-11-27T20:53:50 Z pggp Combo (IOI18_combo) C++14
0 / 100
1 ms 244 KB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;






string guess_sequence(int N){
	string cur = "";
	string first = "";
	if(press("A") == 1){
		cur = "A";
	}
	else if(press("B") == 1){
		cur = "B";
	}
	else if(press("X") == 1){
		cur = "X";
	}
	else{
		cur = "Y";
	}
	first = cur;

	for (int i = 0; i < N; ++i)
	{
		if(first == "A"){
			int a = press(cur + "XY" + cur + "XX" + cur + "XB" + cur + "Y");
			cout << a << endl;
			if(a == cur.size()){
				cur = cur + "B";
			}
			if(a == cur.size() + 1){
				cur = cur + "Y";
			}
			if(a == cur.size() + 2){
				cur = cur + "X";
			}
		}
		if(first == "B"){
			int a = press(cur + "XY" + cur + "XX" + cur + "XA" + cur + "Y");
			if(a == cur.size()){
				cur = cur + "A";
			}
			if(a == cur.size() + 1){
				cur = cur + "Y";
			}
			if(a == cur.size() + 2){
				cur = cur + "X";
			}
		}
		if(first == "X"){
			int a = press(cur + "AY" + cur + "AA" + cur + "AB" + cur + "Y");
			if(a == cur.size()){
				cur = cur + "B";
			}
			if(a == cur.size() + 1){
				cur = cur + "Y";
			}
			if(a == cur.size() + 2){
				cur = cur + "A";
			}
		}
		if(first == "Y"){
			int a = press(cur + "XA" + cur + "XX" + cur + "XB" + cur + "A");
			if(a == cur.size()){
				cur = cur + "B";
			}
			if(a == cur.size() + 1){
				cur = cur + "A";
			}
			if(a == cur.size() + 2){
				cur = cur + "X";
			}
		}
	}

	return cur;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:36:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:39:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:45:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:48:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:51:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:57:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:60:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:63:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:69:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:72:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:75:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 244 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 200 KB Wrong Answer: invalid press
2 Halted 0 ms 0 KB -