Submission #1073645

#TimeUsernameProblemLanguageResultExecution timeMemory
1073645HorizonWestCombo (IOI18_combo)C++17
0 / 100
1 ms600 KiB
#include "combo.h" #include <iostream> #include <complex> #include <iomanip> #include <vector> #include <algorithm> #include <functional> #include <bitset> #include <queue> #include <map> #include <stack> #include <cmath> #include <cstdint> using namespace std; #define endl '\n' #define db double #define ll long long #define pb push_back #define fs first #define sd second #define Mod long(1e9 + 7) #define all(x) x.begin(), x.end() #define unvisited long(-1) #define Eps double(1e-9) #define _for(i, n) for(int i = 0; i < (n); i++) #define dbg(x) cout << #x ": " << x << endl; const int Max = 1e6 + 7, Inf = 1e9 + 7; string C[] = { "A", "B", "X", "Y" }; string query(int n, string s) { vector <string> op; for(int i = 0; i < 4; i++){ if(s[0] != C[i][0]) op.push_back(C[i]); } string q = s + op[0]; for(int i = 0; i < 4; i++){ if(s[0] != C[i][0]) q += s + op[1] + C[i]; } int l = s.size(), t = press(q); if(t == l){ return op[2]; }else if(t == l+1){ return op[0]; }else return op[1]; } string ini(int n, string s){ string a = s + C[0] + s + C[1]; if(press(a)){ if(press(s + C[0])){ return C[0]; }else return C[1]; } else { if(press(s + C[2])){ return C[2]; }else return C[3]; } } string guess_sequence(int N) { string s = ini(N, s); while (s.size() < N){ if(s.size() == N-1) s += ini(N, s); else s += query(N, s); } return s; }

Compilation message (stderr)

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