Submission #934038

#TimeUsernameProblemLanguageResultExecution timeMemory
934038MuntherCarrotCombo (IOI18_combo)C++14
0 / 100
0 ms596 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; // int press(string s) string guess_sequence(int N){ string ans; if(press("BAXAYA") == 1){ ans = "A"; while(ans.size() < N - 1){ string f = ans + "B" + ans + "XB" + ans + "XX" + ans + "XY"; cout << f << endl; int res = press(f); if(res == ans.size()){ ans += "Y"; } else if(res == ans.size() + 1){ ans += "B"; } else{ ans += "X"; } } if(press(ans + "X") == N) ans += "X"; else if(press(ans + "Y") == N) ans += "Y"; else ans += "B"; } else if(press("ABXBYB") == 1){ ans = "B"; while(ans.size() < N - 1){ string f = ans + "A" + ans + "XA" + ans + "XX" + ans + "XY"; int res = press(f); if(res == ans.size()){ ans += "Y"; } else if(res == ans.size() + 1){ ans += "A"; } else{ ans += "X"; } } if(press(ans + "X") == N) ans += "X"; else if(press(ans + "Y") == N) ans += "Y"; else ans += "A"; } else if(press("BXAXYX") == 1){ ans = "X"; while(ans.size() < N - 1){ string f = ans + "B" + ans + "AB" + ans + "AA" + ans + "AY"; int res = press(f); if(res == ans.size()){ ans += "Y"; } else if(res == ans.size() + 1){ ans += "B"; } else{ ans += "A"; } } if(press(ans + "A") == N) ans += "A"; else if(press(ans + "Y") == N) ans += "Y"; else ans += "B"; } else{ ans = "Y"; while(ans.size() < N - 1){ string f = ans + "B" + ans + "XB" + ans + "XX" + ans + "XA"; int res = press(f); if(res == ans.size()){ ans += "A"; } else if(res == ans.size() + 1){ ans += "B"; } else{ ans += "X"; } } if(press(ans + "X") == N) ans += "X"; else if(press(ans + "A") == N) ans += "A"; else ans += "B"; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |         while(ans.size() < N - 1){
      |               ~~~~~~~~~~~^~~~~~~
combo.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |             if(res == ans.size()){
      |                ~~~~^~~~~~~~~~~~~
combo.cpp:19:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |             else if(res == ans.size() + 1){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:32:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |         while(ans.size() < N - 1){
      |               ~~~~~~~~~~~^~~~~~~
combo.cpp:35:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             if(res == ans.size()){
      |                ~~~~^~~~~~~~~~~~~
combo.cpp:38:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             else if(res == ans.size() + 1){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:51:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   51 |         while(ans.size() < N - 1){
      |               ~~~~~~~~~~~^~~~~~~
combo.cpp:54:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |             if(res == ans.size()){
      |                ~~~~^~~~~~~~~~~~~
combo.cpp:57:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             else if(res == ans.size() + 1){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:70:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   70 |         while(ans.size() < N - 1){
      |               ~~~~~~~~~~~^~~~~~~
combo.cpp:73:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |             if(res == ans.size()){
      |                ~~~~^~~~~~~~~~~~~
combo.cpp:76:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |             else if(res == ans.size() + 1){
      |                     ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...