Submission #1102410

#TimeUsernameProblemLanguageResultExecution timeMemory
1102410adiyerCombo (IOI18_combo)C++17
100 / 100
32 ms1832 KiB
#include <bits/stdc++.h> using namespace std; int press(std::string p); string guess_sequence(int N){ string ans, cur, str; int val = press("BA"); if(val){ if(press("A")) ans = "A", str = "BXY"; else ans = "B", str = "AXY"; } else{ if(press("X")) ans = "X", str = "ABY"; else ans = "Y", str = "ABX"; } for(int i = 1, it; i < N - 1; i++){ cur.clear(); cur += ans, cur.push_back(str[0]), cur.push_back(str[0]); cur += ans, cur.push_back(str[0]), cur.push_back(str[1]); cur += ans, cur.push_back(str[0]), cur.push_back(str[2]); cur += ans, cur.push_back(str[1]); it = press(cur); if(it == i + 2){ ans.push_back(str[0]); } else if(it == i + 1){ ans.push_back(str[1]); } else{ ans.push_back(str[2]); } // for(auto it : ans) cout << it; // cout << '\n'; } if(ans.size() < N){ cur = ans, cur.push_back(str[0]); if(press(cur) == N) return cur; cur = ans, cur.push_back(str[1]); if(press(cur) == N) return cur; cur = ans, cur.push_back(str[2]); return cur; } return ans; }

Compilation message (stderr)

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