제출 #553657

#제출 시각아이디문제언어결과실행 시간메모리
553657MadokaMagicaFan콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int fc; char ps[4] = {'A','B','X','Y'}; char getc(int x){ if (x >= fc) ++x; return ps[x]; } string guess_sequence(int N){ string s = ""; // char 1 if (press("AB")){ if (press("A")) fc = 0; else fc = 1; } else { if (press("X")) fc = 2; else fc = 3; } s += ps[fc]; if (N==1) return s; --N; while(--N){ string q = s + getc(0) + s + getc(1) + getc(0) + s + getc(1) + getc(1) + s + getc(1) + getc(2); int ans = press(q); if(ans == s.size()) s += getc(2); else if(ans == s.size() + 1) s += getc(0); else s += getc(1); } if (press(s+getc(0)) == s.size() + 1) s += getc(0); else if (press(s+getc(1)) == s.size() + 1) s += getc(1); else s += getc(2); return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:9: error: 'press' was not declared in this scope
   17 |     if (press("AB")){
      |         ^~~~~
combo.cpp:42:19: error: 'press' was not declared in this scope
   42 |         int ans = press(q);
      |                   ^~~~~
combo.cpp:44:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         if(ans == s.size())
      |            ~~~~^~~~~~~~~~~
combo.cpp:46:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         else if(ans == s.size() + 1)
      |                 ~~~~^~~~~~~~~~~~~~~
combo.cpp:52:9: error: 'press' was not declared in this scope
   52 |     if (press(s+getc(0)) == s.size() + 1)
      |         ^~~~~