Submission #677061

#TimeUsernameProblemLanguageResultExecution timeMemory
677061Toxtaq콤보 (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
//string S = "ABXYYYYYYB";
//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 = 9;
//
//
//int press(std::string p) {
//  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);
//  }
//  num_moves++;
//  return coins;
//}
string guess_sequence(int N){
    string s;
    char fchar;
    if(press("A") == 1)fchar = 'A';
    else if(press("B") == 1)fchar = 'B';
    else if(press("X") == 1)fchar = 'X';
    else fchar = 'Y';
    s += fchar;
    for(int i = 1;i < N;++i){
        if(fchar != 'A' && press(s + 'A') == s.length() + 1)s += 'A';
        else if(fchar != 'B' && press(s + 'B') == s.length() + 1)s += 'B';
        else if(fchar != 'X' && press(s + 'X') == s.length() + 1)s += 'X';
        else s += 'Y';
    }
    return s;
}
//int main()
//{
//    cout << guess_sequence(9);
//    cout << endl << num_moves;
//}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:8: error: 'press' was not declared in this scope
   45 |     if(press("A") == 1)fchar = 'A';
      |        ^~~~~
combo.cpp:51:28: error: 'press' was not declared in this scope
   51 |         if(fchar != 'A' && press(s + 'A') == s.length() + 1)s += 'A';
      |                            ^~~~~