제출 #1362029

#제출 시각아이디문제언어결과실행 시간메모리
1362029lyra_g13Combo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

int press(string p);

string guess_sequence(int n) {
  char t;
  if (press("A"))
    t = 'A';
  else if (press("B"))
    t = 'B';
  else if (press("X"))
    t = 'X';
  else
    t = 'Y';

  /*
  B YB YX YY
  */

  vector<string> ss;
  ss.push_back("B");
  ss.push_back("Y");
  ss.push_back("X");

  ss.push_back("YB");
  ss.push_back("YX");
  ss.push_back("YY");

  if (t == "A") {
    continue;
  } else if (t == "B") {

    ss[0] = "A";
    ss[3] = "YA";
  } else if (t == "X") {
    ss[2] = "A";
    ss[4] = "YA";
  } else if (t == "Y") {

    ss[1] = "A";
    ss[3] = "AB";
    ss[4] = "AX";
    ss[5] = "AA";
  }

  string s;
  s += t;

  for (int i = 1; i < n; i++) {

    string buff = s;
    if (i != n - 1) {
      buff = buff + ss[0] + buff + ss[3] + buff + ss[4] + buff + ss[5];
      ll find = press(buff);
      if (find == s.size() + 1) {
        s += ss[0];
      } else if (find == s.size() + 2)
        s += ss[1];
      else {
        s += ss[2];
      }
    } else if (i == n - 1) {
      string ans = buff + s[0];
      ll find = press(ans);
      if (find == n) {
        return ans;
      } else {
        ans = buff + ss[1];
        find = press(ans);
        if (find == n) {
          return ans;
        } else {
          ans = buff + ss[2];
          return ans;
        }
      }
    }
  }
  return s;
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |   if (t == "A") {
      |       ~~^~~~~~
combo.cpp:33:5: error: continue statement not within a loop
   33 |     continue;
      |     ^~~~~~~~
combo.cpp:34:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |   } else if (t == "B") {
      |              ~~^~~~~~
combo.cpp:38:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |   } else if (t == "X") {
      |              ~~^~~~~~
combo.cpp:41:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   41 |   } else if (t == "Y") {
      |              ~~^~~~~~