제출 #417866

#제출 시각아이디문제언어결과실행 시간메모리
417866LouayFarah콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; int press(string p); string guess_sequence(int n) { string res = ""; string temp = "ABXY"; for(int i = 0; i<3; i++) { string tr = ""; tr.pb(temp[i]); if(press(tr)==1) { res.pb(temp[i]); break; } } if(res.length()==0) res.pb('Y'); string used = ""; for(int i = 0; i<4; i++) { if(res[0]==temp[i]) continue; used.pb(temp[i]); } for(int i = 2; i<n; i++) { string s = ""; s = s + res[0] + used[0]; s = s + res[0] + used[1] + used[0]; s = s + res[0] + used[1] + used[1]; s = s + res[0] + used[1] + used[2]; int k = press(s); if(k==(int)res.size()) res.pb(used[2]); else if(k==(int)res.size() + 1) res.pb(used[0]); else res.pb(used[1]); } return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   14 |         tr.pb(temp[i]);
      |            ^~
combo.cpp:17:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   17 |             res.pb(temp[i]);
      |                 ^~
combo.cpp:22:13: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   22 |         res.pb('Y');
      |             ^~
combo.cpp:29:14: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   29 |         used.pb(temp[i]);
      |              ^~
combo.cpp:42:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   42 |             res.pb(used[2]);
      |                 ^~
combo.cpp:44:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   44 |             res.pb(used[0]);
      |                 ^~
combo.cpp:46:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   46 |             res.pb(used[1]);
      |                 ^~