Submission #410897

#TimeUsernameProblemLanguageResultExecution timeMemory
410897abdzagCombo (IOI18_combo)C++17
97 / 100
47 ms700 KiB
#include<bits/stdc++.h> #include<unordered_map> #include "combo.h" #define rep(i,a,b) for(int i=int(a);i<int(b);i++) #define rrep(i,a,b) for(int i=int(a);i>int(b);i--) #define all(v) v.begin(),v.end() #define trav(a,v) for(auto&a:v) #define sz(a) a.size() typedef long double ld; using namespace std; static const long long inf = 1e15; typedef long long ll; typedef unsigned long long ull; string guess_sequence(int N) { string p = ""; string cringe = ""; vector<string> v = { "A","X","Y","B" }; rep(i, 0, 3) { if (press(v[i])) { cringe += v[i]; v.erase(v.begin() + i); p += cringe; break; } } if (p == "") { cringe += v[3]; v.erase(v.begin() + 3); p += cringe; } ll cur = 1; if (N == 1)return p; rep(i, 0, N - 2) { string nxt = p; nxt += v[0]; nxt += p + v[1] + v[0]; nxt += p + v[1] + v[1]; nxt += p + v[1] + v[2]; int val = press(nxt); if (val == cur + 1) { p += v[0]; } else if (val == cur + 2) { p += v[1]; } else p += v[2]; cur++; } rep(i, 0, 2) { string nxt = p + v[i]; if (press(nxt) == N) { p += v[i]; break; } } if (p.size() != N) { p += v[2]; } return p; }

Compilation message (stderr)

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