Submission #701047

#TimeUsernameProblemLanguageResultExecution timeMemory
701047BobCompetitiveProgrammingCombo (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> using namespace std; using ll=long long; int press(std::string p); string getRandom(string start, string no, int sz){ while(start.size() < sz){ int r = rand() % 4 + 1; if(r==1 && "A" != no) start += "A"; if(r==2 && "B" != no) start += "B"; if(r==3 && "X" != no) start += "X"; if(r==4 && "Y" != no) start += "Y"; } return start; } string guess_sequence(int N){ string S = "", first, a1, a2, a3; if(press("AB")) { if(press("A")) first="A", S="A", a1="B", a2="X", a3="Y"; else first="B", S="B", a1="A", a2="X", a3="Y"; } else { if(press("X")) first="X", S="X", a1="B", a2="A", a3="Y"; else first="Y", S="Y", a1="B", a2="X", a3="A"; } vector<string> a{a1, a2, a3}; while(true){ int curr_size = S.size(); if(curr_size == N) return S; ll nxt = press(S+a1+a1 + S+a1+a2 + S+a1+a3 + S+a2) - curr_size; if(nxt==2) S+=a1; if(nxt==1) S+=a2; if(nxt==0) S+=a3; } }

Compilation message (stderr)

combo.cpp: In function 'std::string getRandom(std::string, std::string, int)':
combo.cpp:8:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |     while(start.size() < sz){
      |           ~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...