제출 #127110

#제출 시각아이디문제언어결과실행 시간메모리
127110reda콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string t = "" ,v; int a=press("A"),b=press("B"),x=press("Y"),y=press("Y"); if(a){t.push_back('A'); v= "BXY"; } if(b){ t.push_back('B'); v= "AXY"; } if(y) { t.push_back('Y'); v="ABX"; } if(x){ t.push_back('X'); v="ABY" ; } int i=0; while(t.size()!=N) { int h=press(t+v[i%N]); if(h)v.push_back(v[i%N]); i++; } return t; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:13: error: 'press' was not declared in this scope
    8 |       int a=press("A"),b=press("B"),x=press("Y"),y=press("Y");
      |             ^~~~~
combo.cpp:14:10: error: 'b' was not declared in this scope
   14 |       if(b){
      |          ^
combo.cpp:18:9: error: 'y' was not declared in this scope
   18 |      if(y)
      |         ^
combo.cpp:25:9: error: 'x' was not declared in this scope
   25 |      if(x){
      |         ^
combo.cpp:30:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |      while(t.size()!=N)
      |            ~~~~~~~~^~~