Submission #889281

#TimeUsernameProblemLanguageResultExecution timeMemory
889281Hugo1729Combo (IOI18_combo)C++11
10 / 100
17 ms1440 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; // int press(string q){return 1;} string guess_sequence(int N){ string ans; string letters[3]; if (press("A")==1) {ans="A";letters[0]="B";letters[1]="X";letters[2]="Y";} if (press("B")==1) {ans="B";letters[0]="A";letters[1]="X";letters[2]="Y";} if (press("X")==1) {ans="X";letters[0]="B";letters[1]="A";letters[2]="Y";} if (press("Y")==1) {ans="Y";letters[0]="B";letters[1]="X";letters[2]="A";} int n=1; while(ans.length()<=N-1){ // int query = press((ans+letters[0])+(ans+letters[1]+letters[0])+(ans+letters[1]+letters[1])+(ans+letters[1]+letters[2])); // if (query==n+1) ans+=letters[0]; // else if (query==n+2) ans+=letters[1]; // else ans+=letters[2]; if(press(ans+letters[0])==n+1) ans+=letters[0]; else if(press(ans+letters[1])==n+1) ans+=letters[1]; else ans+=letters[2]; n++; } // if (press(ans+letters[0])==N) ans+=letters[0]; // else if (press(ans+letters[1])==N) ans+=letters[1]; // else ans+=letters[2]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |   while(ans.length()<=N-1){
      |         ~~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...