Submission #689950

#TimeUsernameProblemLanguageResultExecution timeMemory
689950Jovan26콤보 (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string s = ""; char slova[4] = {'A', 'B', 'X', 'Y'}; string tempp = "AB"; int a = press(tempp); if(a==1){ int b = press("B"); if(b==1) s.push_back('B'); else s.push_back('A'); } else{ int b = press("X"); if(b==1) s.push_back('X'); else s.push_back('Y'); } if(N==1) return s; if(s[0]=='A'){ for(int i=0;i<N-1;i++){ string temp = s; temp.push_back('X'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('X'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('B'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('Y'); int a = press(temp); int x = s.size(); if(a==x) s.push_back('B'); else if(a==x+1) s.push_back('X'); else s.push_back('Y'); } int a = press(s+"B"); if(a==s.size()+1) s.push_back('B'); else{ int b = press(s+"X"); if(b==s.size()+1) s.push_back('X'); else s.push_back('Y'); } } else if(s[0]=='B'){ for(int i=1;i<N-1;i++){ string temp = s; temp.push_back('X'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('X'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('A'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('Y'); int a = press(temp); int x = s.size(); if(a==x) s.push_back('A'); else if(a==x+1) s.push_back('X'); else s.push_back('Y'); } int a = press(s+"A"); if(a==s.size()+1) s.push_back('A'); else{ int b = press(s+"X"); if(b==s.size()+1) s.push_back('X'); else s.push_back('Y'); } } else if(s[0]=='X'){ for(int i=1;i<N-1;i++){ string temp = s; temp.push_back('A'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('B'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('A'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('Y'); temp.push_back('Y'); int a = press(temp); int x = s.size(); if(a==x) s.push_back('B'); else if(a==x+1) s.push_back('A'); else s.push_back('Y'); } int a = press(s+"A"); if(a==s.size()+1) s.push_back('A'); else{ int b = press(s+"B"); if(b==s.size()+1) s.push_back('B'); else s.push_back('Y'); } } else if(s[0]=='Y'){ for(int i=1;i<N-1;i++){ string temp = s; temp.push_back('X'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('A'); temp.push_back('X'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('A'); temp.push_back('B'); for(int j=0;j<s.size();j++) temp.push_back(s[j]); temp.push_back('A'); temp.push_back('A'); int a = press(temp); int x = s.size(); if(a==x) s.push_back('B'); else if(a==x+1) s.push_back('X'); else s.push_back('A'); } int a = press(s+"A"); if(a==s.size()+1) s.push_back('A'); else{ int b = press(s+"X"); if(b==s.size()+1) s.push_back('X'); else s.push_back('B'); } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:44:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   if(a==s.size()+1) s.push_back('B');
      |      ~^~~~~~~~~~~~
combo.cpp:47:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     if(b==s.size()+1) s.push_back('X');
      |        ~^~~~~~~~~~~~
combo.cpp:59:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:63:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:67:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:78:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |   if(a==s.size()+1) s.push_back('A');
      |      ~^~~~~~~~~~~~
combo.cpp:81:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |     if(b==s.size()+1) s.push_back('X');
      |        ~^~~~~~~~~~~~
combo.cpp:94:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   94 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:98:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   98 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:102:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  102 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:113:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  113 |   if(a==s.size()+1) s.push_back('A');
      |      ~^~~~~~~~~~~~
combo.cpp:116:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  116 |     if(b==s.size()+1) s.push_back('B');
      |        ~^~~~~~~~~~~~
combo.cpp:130:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  130 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:134:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  134 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:138:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  138 |     for(int j=0;j<s.size();j++) temp.push_back(s[j]);
      |                 ~^~~~~~~~~
combo.cpp:149:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  149 |   if(a==s.size()+1) s.push_back('A');
      |      ~^~~~~~~~~~~~
combo.cpp:152:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  152 |     if(b==s.size()+1) s.push_back('X');
      |        ~^~~~~~~~~~~~
combo.cpp:6:8: warning: unused variable 'slova' [-Wunused-variable]
    6 |   char slova[4] = {'A', 'B', 'X', 'Y'};
      |        ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...