제출 #228772

#제출 시각아이디문제언어결과실행 시간메모리
228772two_sidesCombo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
 
string guess_sequence(int n){
  string res; vector <char> c = {'A', 'B', 'X', 'Y'};
  if (press("AB") >= 1) res = press("A") ? "A" : "B";
  else res = press("X") ? "X" : "Y";
  c.erase(find(c.begin(), c.end(), res[0]));
  while (int(size(res)) <= n - 2){
    int que = press(res + c[0] + res + c[1] + c[0] + res + c[1] + c[1] + res + c[1] + c[2]);
    if (que == size(res)) res.push_back(c[2]);
    if (que == size(res) + 1) res.push_back(c[0]);
    if (que == size(res) + 2) res.push_back(c[1]);
  }
  if (int(size(res)) < n){
    if (press(res + p[0]) == n) res.push_back(p[0]);
    else if (press(res + p[1]) == n) res.push_back(p[1]);
    else res.push_back(p[2]);
  }
  return res;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     if (que == size(res)) res.push_back(c[2]);
      |         ~~~~^~~~~~~~~~~~
combo.cpp:13:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     if (que == size(res) + 1) res.push_back(c[0]);
      |         ~~~~^~~~~~~~~~~~~~~~
combo.cpp:14:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     if (que == size(res) + 2) res.push_back(c[1]);
      |         ~~~~^~~~~~~~~~~~~~~~
combo.cpp:17:21: error: 'p' was not declared in this scope
   17 |     if (press(res + p[0]) == n) res.push_back(p[0]);
      |                     ^