Submission #310808

#TimeUsernameProblemLanguageResultExecution timeMemory
310808EJamCombo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; const string buttons = "ABXY"; char solveNext(string a){ string nxtOp; for (auto c: buttons){ if (c != a[0]){ nxtOp.push_back(c); } } string p = a + nxtOp[0] + nxtOp[0] + a + nxtOp[0] + nxtOp[1] + a + nxtOp[0] + nxtOp[2] + a + nxtOp[1]; // cout<<p<<endl; int res = press(p); if (res == a.length() + 1){ return nxtOp[1]; } if (res == a.length() + 2){ return nxtOp[0]; } if (res == a.length()){ return nxtOp[2]; } return 'z'; } std::string guess_sequence(int N) { string ans; char ans1; for (auto it: buttons){ if (press(string(1, it)) == 1){ ans.push_back(it); break; } } for (int i = 1; i < N-1; i++){ ans.push_back(solveNext(ans)); } for (auto it: buttons){ if (it != ans[0] && press(ans + it) == N){ return ans + it; } } cout<<"foo"<<endl; return ans; }

Compilation message (stderr)

combo.cpp: In function 'char solveNext(std::string)':
combo.cpp:16:10: 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 == a.length() + 1){
      |      ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:19:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  if (res == a.length() + 2){
      |      ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:22:10: 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 (res == a.length()){
      |      ~~~~^~~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:7: warning: unused variable 'ans1' [-Wunused-variable]
   30 |  char ans1;
      |       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...