Submission #541472

#TimeUsernameProblemLanguageResultExecution timeMemory
541472MdominykasCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { cout << "N = " << N << endl; vector<char> letters = {'A', 'B', 'X', 'Y'}; char init; if(press("AB") >= 1) { if(press("A") >= 1) init = 'A'; else init = 'B'; } else { if(press("X") >= 1) init = 'X'; else init = 'Y'; } for(int i = 0; i < (int)letters.size(); i++) { if(letters[i] == init) swap(letters[i], letters.back()); } letters.pop_back(); // vector<char> p; // p.pus // cout << "init = " << init << endl; std::string p = ""; p += init; // cout << "init p = " << p << endl; for(int i = 1; i < N - 1; i++) { string S = p + letters[0] + p + letters[1] + letters[0] + p + letters[1] + letters[1] + p + letters[1] + letters[2]; int coins = press(S); if(coins == (int) p.size()) p += letters[2]; else if (coins == (int) p.size() + 1) p += letters[0]; else p += letters[1]; } // cout << "near final: " << p << endl; if(press(p + letters[0]) == N) p += letters[0]; else if(press(p + letters[1]) == N) p += letters[1]; else p += letters[2]; return p }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:65:10: error: expected ';' before '}' token
   65 |  return p
      |          ^
      |          ;
   66 | }
      | ~