제출 #1104867

#제출 시각아이디문제언어결과실행 시간메모리
1104867monaxia콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" #define pb push_back #define ppb pop_back #define fr first #define sc second #define all(v) v.begin(), v.end() #define eps (long long)(1e-9) using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; const ll Mod = 1e9 + 7; string guess_sequence(int n){ string ans = "", temp = "ABXY"; int cnt = 0; while(cnt != n){ for(auto& x : temp){ ans.pb(ans); if(press(ans) > cnt){ cnt ++; break; } ans.pp(); } } return ans; } // signed main() // { // cin.tie(0)->sync_with_stdio(0); // if(fopen("blank.inp", "r")){ // freopen("blank.inp", "r", stdin); // freopen("blank.out", "w", stdout); // } // // cout << 1; return 0; // ll n = 1; // // cin >> n; // while(n) { // solve(); // n --; // cout << "\n"; // } // // cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; // }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:20: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   23 |             ans.pb(ans);
      |                    ^~~
      |                    |
      |                    std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:1320:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1320 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
combo.cpp:29:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pp'
   29 |             ans.pp();
      |                 ^~
combo.cpp:22:19: warning: unused variable 'x' [-Wunused-variable]
   22 |         for(auto& x : temp){
      |                   ^