제출 #683943

#제출 시각아이디문제언어결과실행 시간메모리
683943Juan콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; string guess_sequence(int N){ string ans = ""; char A, B, C, D; set<int> st; st.insert('A'), st.insert('B'), st.insert('X'), st.insert('Y'); if(press("AB")){ if(press("A")) A = 'A'; else A = 'B'; } else{ if(press("X")) A = 'X'; else A = 'Y'; } ans+=A; st.erase(A); auto it = st.begin(); B = *it, it++, C = *it, it++, D = *it; for(int i = 1; i < N-1; i++){ string aux=""; aux+=ans, aux+=B, aux+=B; aux+=ans, aux+=C, aux+=C; int prs = press(aux) - i; if(prs==0){ ans+=C; } else if(prs==1){ string aux2=""; aux2+=ans, aux2+=B; if(press(aux2)-i) ans+=B; else ans+=C; ans+=D; i++; } else if(prs==2){ string aux2=""; aux2+=ans, aux2+=B; if(press(aux2)-i == 2) ans+=B, ans+=B; else ans+=C, ans+=C; } } if(ans.size()<N){ string aux = ""; aux+=ans, aux+=B; if(press(aux)==N) ans+=B; else{ aux.pop_back(); aux+=C; if(press(aux)==N) ans+=C; else ans+=D; } } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:5: error: 'press' was not declared in this scope
   11 |  if(press("AB")){
      |     ^~~~~
combo.cpp:28:13: error: 'press' was not declared in this scope; did you mean 'prs'?
   28 |   int prs = press(aux) - i;
      |             ^~~~~
      |             prs
combo.cpp:48:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |  if(ans.size()<N){
      |     ~~~~~~~~~~^~
combo.cpp:51:6: error: 'press' was not declared in this scope
   51 |   if(press(aux)==N) ans+=B;
      |      ^~~~~