제출 #526663

#제출 시각아이디문제언어결과실행 시간메모리
526663lcs147콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "combo.h" #define int long long using namespace std; // string s; // int cnt = 0; // int press(string p) { // int res = 0; // for(int i=0; i<p.size(); i++) { // for(int t=1; t<=s.size() && i+t<=p.size(); t++) { // if(s.substr(0, t) == p.substr(i, t)) { // res = max(res, t); // } // } // } // cnt++; // return res; // } string guess_sequence(int n) { set<char> possible = {'A','B','X','Y'}; string res; while(res.size() < n) { for(char c:possible) { if(press(res+c) == res.size()+1) { res += c; if(res.size() == 1) { possible.erase(c); } break; } } } return res; } // int32_t main(){ // ios_base::sync_with_stdio(false); // cin.tie(0); // #define endl '\n' // s = "X"; // vector<char> possible = {'A','B','Y'}; // while(s.size() < 100) s += possible[rand()%3]; // cout << s << endl; // cout << guess_sequence(s.size()) << endl; // cout << cnt << endl; // return 0; // }

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

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:25:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   25 |     while(res.size() < n) {
      |           ~~~~~~~~~~~^~~
combo.cpp:27:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             if(press(res+c) == res.size()+1) {
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc89Pp6V.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status