Submission #1083654

#TimeUsernameProblemLanguageResultExecution timeMemory
1083654erdemfurkanCombo (IOI18_combo)C++14
0 / 100
1 ms344 KiB
#include "combo.h" #include <iostream> using namespace std; string s; string guess_sequence(int N) { int a = press("A"); int b = press("B"); int x = press("X"); int y = !(a&b&x); if(a) { s += 'A'; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N-1) { string tmp = s; tmp += 'B'; string tmp2 = s; tmp2 += 'Y'; tmp2 += 'B'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'Y'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'X'; string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'X'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'B'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'Y'; } } if(press(s+'B')==N) return s+'B'; else if(press(s+'X')==N) return s+'X'; else return s+'Y'; } if(b) { s += 'B'; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N-1) { string tmp = s; tmp += 'X'; string tmp2 = s; tmp2 += 'Y'; tmp2 += 'X'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'A'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'Y'; string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'A'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'X'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'Y'; } } if(press(s+'A')==N) return s+'A'; else if(press(s+'X')==N) return s+'X'; else return s+'Y'; } if(x) { s += 'X'; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N) { string tmp = s; tmp += 'B'; string tmp2 = s; tmp2 += 'Y'; tmp2 += 'B'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'Y'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'A'; string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'A'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'B'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'Y'; } } if(press(s+'A')==N) return s+'A'; else if(press(s+'B')==N) return s+'B'; else return s+'Y'; } if (y) { s += 'Y'; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N) { string tmp = s; tmp += 'b'; string tmp2 = s; tmp2 += 'X'; tmp2 += 'B'; tmp2 += s; tmp2 += 'X'; tmp2 += 'X'; tmp2 += s; tmp2 += 'X'; tmp2 += 'A'; string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'A'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'B'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'X'; } } if(press(s+'A')==N) return s+'A'; else if(press(s+'B')==N) return s+'B'; else return s+'X'; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     while(s.length() != N-1) {
      |           ~~~~~~~~~~~^~~~~~
combo.cpp:32:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:36:16: 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(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:40:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       if(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:53:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |     while(s.length() != N-1) {
      |           ~~~~~~~~~~~^~~~~~
combo.cpp:67:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:71:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |       if(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:75:16: 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(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:88:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   88 |     while(s.length() != N) {
      |           ~~~~~~~~~~~^~~~
combo.cpp:102:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  102 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:106:16: 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(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:110:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  110 |       if(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:123:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  123 |     while(s.length() != N) {
      |           ~~~~~~~~~~~^~~~
combo.cpp:138:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  138 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:142:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  142 |       if(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:146:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  146 |       if(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:155:1: warning: control reaches end of non-void function [-Wreturn-type]
  155 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...