# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677099 | Toxtaq | Combo (IOI18_combo) | C++17 | 46 ms | 452 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
//string S;
//int num_moves = 0;
//constexpr int MAX_N = 2000;
//constexpr int MAX_NUM_MOVES = 8000;
//
//void wrong_answer(const char *MSG) {
// printf("Wrong Answer: %s\n", MSG);
// exit(0);
//}
//int N;
//
//int cnt = 0;
//int press(std::string p) {
// cnt++;
// if (++num_moves > MAX_NUM_MOVES) {
// wrong_answer("too many moves");
// }
// int len = p.length();
// if (len > 4 * N) {
// wrong_answer("invalid press");
// }
// for (int i = 0; i < len; ++i) {
// if (p[i] != 'A' && p[i] != 'B' && p[i] != 'X' && p[i] != 'Y') {
// wrong_answer("invalid press");
// }
// }
// int coins = 0;
// for (int i = 0, j = 0; i < len; ++i) {
// if (j < N && S[j] == p[i]) {
// ++j;
// } else if (S[0] == p[i]) {
// j = 1;
// } else {
// j = 0;
// }
// coins = std::max(coins, j);
// }
// return coins;
//}
int press(string s);
string guess_sequence(int N){
string s;
string d;
if(press("A") == 1){d = "BXY";s += 'A';}
else if(press("B") == 1){d = "AXY";s += 'B';}
else if(press("X") == 1){d = "ABY";s += 'X';}
else {d = "ABX";s += 'Y';}
// cout << d << '\n';
for(int i = 1;i < N;++i){
if(press(s + d[0]) == s.length() + 1)s += d[0];
else if(press(s + d[1]) == s.length() + 1)s += d[1];
else s += d[2];
}
return s;
}
//int main()
//{
// S = "XAAA";
// for(int i = 0;i < 1999;++i)S += 'Y';
// N = S.length();
// cout << guess_sequence(S.length());
// cout << endl << S.length() << " " << num_moves;
//}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |