Submission #750139

#TimeUsernameProblemLanguageResultExecution timeMemory
750139tlnk07콤보 (IOI18_combo)C++17
0 / 100
1 ms256 KiB
#include<bits/stdc++.h> #include<combo.h> using namespace std; string guess_sequence(int N) { string s; string c[10]; int hm = press("AB"); if(hm == 0) { if(press("C") == 0) { s += 'Y'; c[1] = 'A'; c[2] = 'B'; c[3] = 'X'; } else { s += 'X'; c[1] = 'A'; c[2] = 'B'; c[3] = 'Y'; } } else if(hm == 1) { if(press("A") == 0) { s += 'B'; c[1] = 'A'; c[2] = 'Y'; c[3] = 'X'; } else { s += 'A'; c[1] = 'X'; c[2] = 'B'; c[3] = 'Y'; } } else { s += "AB"; } while(s.size() < N - 1) { string temp = s + c[1] + c[1] + s + c[1] + c[2] + s + c[2] + c[1]; int inp = press(temp); if(inp == s.size()) { s += c[3]; } else if(inp == s.size() + 1) { string temp1 = s + c[2] + c[2]; int inp1 = press(temp1); if(inp1 == s.size() + 2) { s = temp1; } else if(inp1 == s.size() + 1) { s += c[2] + c[3]; } else { s += c[1] + c[3]; } } else { string temp1 = s + c[1] + c[1]; int inp1 = press(temp1); if(inp1 == s.size() + 2) { s = temp1; } else if(inp1 == s.size() + 1) { s += c[1] + c[2]; } else { s += c[2] + c[1]; } } } if(s.size() == N) { return s; } else { string temp = s + c[1]; if(press(temp) == N) { return temp; } else { temp = s + c[2]; if(press(temp) == N) { return temp; } else { return s + c[3]; } } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |  while(s.size() < N - 1)
      |        ~~~~~~~~~^~~~~~~
combo.cpp:44:10: 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(inp == s.size())
      |      ~~~~^~~~~~~~~~~
combo.cpp:48:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   else if(inp == s.size() + 1)
      |           ~~~~^~~~~~~~~~~~~~~
combo.cpp:52:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |    if(inp1 == s.size() + 2)
      |       ~~~~~^~~~~~~~~~~~~~~
combo.cpp:56:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |    else if(inp1 == s.size() + 1)
      |            ~~~~~^~~~~~~~~~~~~~~
combo.cpp:69:12: 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(inp1 == s.size() + 2)
      |       ~~~~~^~~~~~~~~~~~~~~
combo.cpp:73:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |    else if(inp1 == s.size() + 1)
      |            ~~~~~^~~~~~~~~~~~~~~
combo.cpp:83:14: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   83 |  if(s.size() == N)
      |     ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...