제출 #861690

#제출 시각아이디문제언어결과실행 시간메모리
861690AriadnaCombo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int press(string& p); vector < char > aux; string first_char() { string s = "AB"; if (press(s)) { s = "A"; if (press(s)) { aux = {'B', 'X', 'Y'}; return s; } aux = {'A', 'X', 'Y'}; return "B"; } s = "X"; if (press(s)) { aux = {'A', 'B', 'Y'}; return s; } aux = {'A', 'B', 'X'}; return "Y"; } string guess_sequence(int N) { string s = first_char(); for (int i = 2; i < N; ++i) { cout << i << " " << s << endl; string q = s + aux[0] + aux[0] + s + aux[0] + aux[1] + s + aux[0] + aux[2] + s + aux[1]; int ans = press(q); if (ans == i + 1) s += aux[0]; else if (ans == i) s += aux[1]; else s += aux[2]; } if (N > 1) { s += aux[0]; if (press(s) == N) return s; s[N - 1] = aux[1]; if (press(s) == N) return s; s[N - 1] = aux[2]; return s; } return s; }

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

/usr/bin/ld: /tmp/cc3M9d1A.o: in function `first_char[abi:cxx11]()':
combo.cpp:(.text+0x179): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/bin/ld: combo.cpp:(.text+0x1a1): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/bin/ld: combo.cpp:(.text+0x21d): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/bin/ld: /tmp/cc3M9d1A.o: in function `guess_sequence[abi:cxx11](int)':
combo.cpp:(.text+0x999): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/bin/ld: combo.cpp:(.text+0xcee): undefined reference to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/bin/ld: /tmp/cc3M9d1A.o:combo.cpp:(.text+0xd1c): more undefined references to `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' follow
collect2: error: ld returned 1 exit status