Submission #926929

#TimeUsernameProblemLanguageResultExecution timeMemory
926929bobbilykingCombo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { vector<char> poss{'A', 'B', 'X', 'Y'}; string cur; if (press("AB")) { if (press("A")) cur = "A"; else cur = "B"; } else { if (press("X")) cur = "X"; else cur = "Y"; } auto dumbextend = [&]() { bool done = 0; for (int i = 0; i < 2; ++i) { cur += poss[i]; if (press(cur) == cur.size()) { done = 1; break; } cur.pop_back(); } if (!done) cur += poss[2]; }; while (cur.size() < N) { // might not need this, but im scared of querying too mayn letters // dumbextend(); continue; if (cur.size() + 1 == N) dumbextend(); else { string temp; temp += cur + poss[0]; for (int j= 0 ; j < 3; ++j) temp += (cur + poss[1]) + poss[j]; auto res = press(temp); if (res == cur.size()) cur += poss[2]; else if (res == cur.size() + 1) cur += poss[0]; else cur += poss[1]; } } // cout << "WTF " << cur << endl; // cout << cur << " " << cur.size() << " " << N << endl; assert(cur.size() == N); return cur; }

Compilation message (stderr)

combo.cpp: In lambda function:
combo.cpp:22:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             if (press(cur) == cur.size()) {
      |                 ~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |     while (cur.size() < N) {
      |            ~~~~~~~~~~~^~~
combo.cpp:33:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |         if (cur.size() + 1 == N) dumbextend();
      |             ~~~~~~~~~~~~~~~^~~~
combo.cpp:40:21: 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 (res == cur.size()) cur += poss[2];
      |                 ~~~~^~~~~~~~~~~~~
combo.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             else if (res == cur.size() + 1) cur += poss[0];
      |                      ~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:2:
combo.cpp:48:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |     assert(cur.size() == N);
      |            ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...