제출 #675749

#제출 시각아이디문제언어결과실행 시간메모리
675749GGOSHAB콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <random> #define PI 3.14159265359 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> bigInt; const ull INF = -1; int press(const string &s); string guess_sequence(int n) { string ans; ans.reserve(n); if (press("AB")) { if (press("A")) ans.push_back('A'); else ans.push_back('B'); } else { if (press("X")) ans.push_back('X'); else ans.push_back('Y'); } char ex = ans[0]; string t, letters = "ABXY", tl; for (char c : letters) if (c != ex) tl.push_back(c); t.reserve(4 * n); for (int i = 2; i <= n; ++i) { for (int i = 0; i < 3; ++i) { t += ans; t.push_back(tl[i]); } int size = t.length() / 3; if (press(t.substr(0, size << 1))) { if (press(t.substr(0, size))) ans.push_back(tl[0]); else ans.push_back(tl[1]); } else { ans.push_back(tl[2]); } } return ans; } int main() { ios::sync_with_stdio(0); cin.tie(0); //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); return 0; }

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

/usr/bin/ld: /tmp/ccVUZkKQ.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccDTxBDO.o:combo.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccDTxBDO.o: in function `guess_sequence[abi:cxx11](int)':
combo.cpp:(.text+0x14b): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: combo.cpp:(.text+0x1a0): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: combo.cpp:(.text+0x22c): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: combo.cpp:(.text+0x53c): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: combo.cpp:(.text+0x5a3): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status