Submission #489570

#TimeUsernameProblemLanguageResultExecution timeMemory
489570PoPularPlusPlusCombo (IOI18_combo)C++17
100 / 100
43 ms668 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pb(e) push_back(e) #define sv(a) sort(a.begin(),a.end()) #define sa(a,n) sort(a,a+n) #define mp(a,b) make_pair(a,b) #define vf first #define vs second #define ar array #define all(x) x.begin(),x.end() const int inf = 0x3f3f3f3f; const int mod = 1000000007; const double PI=3.14159265358979323846264338327950288419716939937510582097494459230; bool remender(ll a , ll b){return a%b;} string guess_sequence(int n){ string s = ""; int x = press("AB"); if(x >= 1){ x = press("A"); if(x == 1)s += "A"; else s += "B"; } else { x = press("X"); if(x == 1)s += "X"; else s += "Y"; } string rem = ""; char arr[4] = {'A','B','X','Y'}; for(int i = 0; i < 4; i++){ if(arr[i] == s[0])continue; rem += arr[i]; } while((int)s.size() < n-1){ string t = s + rem[0] + s + rem[1] + rem[0] + s + rem[1] + rem[1] + s + rem[1] + rem[2]; x = press(t); if(x == (int)s.size()){ s += rem[2]; } else if(x == (int)s.size() + 1)s += rem[0]; else s += rem[1]; } if(s.size() == n)return s; string t = s + rem[0]; x = press(t); if(x == s.size() + 1)s += rem[0]; else { t = s + rem[1]; x= press(t); if(x == s.size() + 1)s += rem[1]; else s += rem[2]; } return s; } /* int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t;cin >> t;while(t--) solve(); return 0; } */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:47:14: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |  if(s.size() == n)return s;
      |     ~~~~~~~~~^~~~
combo.cpp:50:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |  if(x == s.size() + 1)s += rem[0];
      |     ~~^~~~~~~~~~~~~~~
combo.cpp:54:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |    if(x == s.size() + 1)s += rem[1];
      |       ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...