Submission #540135

#TimeUsernameProblemLanguageResultExecution timeMemory
540135Ronin13Combo (IOI18_combo)C++14
100 / 100
37 ms548 KiB
#include "combo.h" #include <bits/stdc++.h> #define ll long long #define ull unsigned ll #define f first #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define epb emplace_back using namespace std; const int inf = 1e9 + 1; const ll linf = 1e18 + 1; const int mod = 1e9 + 7; std::string guess_sequence(int N) { int n=N; string cur = ""; int c = press("AB"); if(c >= 1){ c = press("A"); if(c == 1)cur += 'A'; else cur += 'B'; } else{ c = press("X"); if(c == 1)cur += "X"; else cur += 'Y'; } vector<char>s; if(cur[0] != 'A')s.pb('A'); if(cur[0] != 'B')s.pb('B'); if(cur[0] != 'X')s.pb('X'); if(cur[0] != 'Y')s.pb('Y'); for(int i=2;i<n;i++){ string p=""; // p = cur; for(int j = 0; j < 3; j++){ string x = ""; x += s[0]; x += s[j]; p += cur; p += x; } p += cur; p += s[1]; c = press(p); if(c == i + 1){ cur += s[0]; } if(c == i){ cur += s[1]; } if(c < i){ cur += s[2]; } } if(cur.size() == n) return cur; c = press(cur + s[0] + cur + s[1]); if(c == n){ c = press(cur + s[0]); if(c == n)cur += s[0]; else cur += s[1]; } else cur += s[2]; return cur; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:58:19: 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(cur.size() == n) return cur;
      |        ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...