Submission #139622

#TimeUsernameProblemLanguageResultExecution timeMemory
139622bazsi700Combo (IOI18_combo)C++14
0 / 100
3080 ms212 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" int press(string s); 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+= st; ask+= currs; ask+= chs[1]; ask+= chs[0]; ask+= st; ask+= currs; ask+= chs[1]; ask+= chs[1]; ask+= st; ask+= currs; ask+= chs[1]; ask+= chs[2]; if(ask.length() > 4*n) { while(true) {} } int x = press(ask); if(x == i-1) { currs+= chs[2]; } else if(x == i) { currs+= chs[0]; } else { currs+= chs[1]; } } string ask = currs; ask+= chs[0]; if(press(ask) == n) { currs+= chs[0]; } else { ask = currs; ask+= chs[1]; if(press(ask) == n) { currs+= chs[1]; } else { currs+= chs[2]; } } return currs; }

Compilation message (stderr)

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