Submission #139645

#TimeUsernameProblemLanguageResultExecution timeMemory
139645bazsi700Combo (IOI18_combo)C++14
5 / 100
2 ms268 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define MOD 1000000007 #define ll long long int #define vi vector<int> #define vii vector< vector<int> > #define PI 3.1415926535897932384626433832795 #define INF 9223372036854775807LL #define hashA 1257958787 #define hashB 1539500609 #define endl "\n" string guess_sequence(int n) { char st; vector<char> chs; if(press("AB")) { if(press("A")) { st = 'A'; chs = {'B','X','Y'}; } else { st = 'B'; chs = {'A','X','Y'}; } } else { if(press("X")) { st = 'X'; chs = {'A','B','Y'}; } else { st = 'Y'; chs = {'A','B','X'}; } } string currs = ""; currs+= st; for(int i = 2; i < n; i++) { string ask = currs; ask+= chs[0]; ask+= currs; ask+= chs[1]; ask+= chs[0]; ask+= currs; ask+= chs[1]; ask+= chs[1]; ask+= currs; ask+= chs[1]; ask+= chs[2]; int x = press(ask); if(x == i-1) { currs+= chs[2]; } else if(x == i) { currs+= chs[0]; } else { currs+= chs[1]; } } if(currs.length() < n-1) { while(true) {} } string ask = currs; ask+= chs[0]; if(press(ask) == n) { currs+= chs[0]; } else { string askk = currs; askk+= chs[1]; if(press(askk) == n) { currs+= chs[1]; } else { currs+= chs[2]; } } return currs; }

Compilation message (stderr)

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