Submission #314826

#TimeUsernameProblemLanguageResultExecution timeMemory
314826jwvg0425Combo (IOI18_combo)C++17
5 / 100
1 ms200 KiB
#include <stdio.h> #include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <bitset> #include <map> #include <set> #include <tuple> #include <string.h> #include <math.h> #include <random> #include <functional> #include <assert.h> #include <math.h> #include "combo.h" #define all(x) (x).begin(), (x).end() #define xx first #define yy second using namespace std; template<typename T, typename Pr = less<T>> using pq = priority_queue<T, vector<T>, Pr>; using i64 = long long int; using ii = pair<int, int>; using ii64 = pair<i64, i64>; string guess_sequence(int n) { string s; int k = press("AB"); if (k > 0) { if (press("A") == 1) s = "A"; else s = "B"; } else { if (press("X") == 1) s = "X"; else s = "Y"; } string c = "ABXY"; c.erase(find(all(c), s[0])); while (s.size() < n - 1) { string q = s + c[0] + s + c[1] + c[0] + s + c[1] + c[1] + s + c[1] + c[2]; int len = press(q); if (len == s.size()) s += c[2]; else if (len == s.size() + 1) s += c[0]; else s += c[1]; } if (press(s + c[0]) == n) s += c[0]; else if (press(s + c[1]) == n) s += c[1]; else s += c[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:52:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |  while (s.size() < n - 1)
      |         ~~~~~~~~~^~~~~~~
combo.cpp:57:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |   if (len == s.size())
      |       ~~~~^~~~~~~~~~~
combo.cpp:59:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |   else if (len == s.size() + 1)
      |            ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...