제출 #1014419

#제출 시각아이디문제언어결과실행 시간메모리
1014419rayan_bdCombo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ string p=""; if(press("A")==1) p="A"; else if(press("B")==1) p="B"; else if(press("Y")==1) p="Y"; else p="X"; if(N==1) return p; if(N>3) return ""; queue<string> q; q.push(p); vector<string> choice={"A","B","X","Y"}; while(q.size()){ string last=q.front();q.pop(); if(last.size()==N) return last; for(auto it:choice){ if(it[0]!=last[0]&&press(last+it)==last.size()+1){ q.push(last+it); break; } } } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:5: error: 'press' was not declared in this scope
    6 |  if(press("A")==1) p="A";
      |     ^~~~~
combo.cpp:21:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |   if(last.size()==N) return last;
      |      ~~~~~~~~~~~^~~
combo.cpp:23:23: error: 'press' was not declared in this scope
   23 |    if(it[0]!=last[0]&&press(last+it)==last.size()+1){
      |                       ^~~~~