제출 #1305837

#제출 시각아이디문제언어결과실행 시간메모리
1305837fafnir콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define LOCAL 0 #ifdef LOCAL int press(string s); #endif const int M = 4; const char ABC[] = "ABXY"; string guess_sequence(int N) { string s; int len[M]; REP(i, N) { bool found = false; REP(j, M-1) { len[j] = press(s + ABC[j]); if (len[j] == i+1) { s += ABC[j]; found = true; break; } } if (!found) { s += ABC[M-1]; } } return s; } #ifdef LOCAL string SECRET = "ABXYYB"; int press(string p) { const int m = p.length(); const int n = SECRET.length(); int lpref = 0; REP(i, m) { int j = 0; while (j < n && i+j < m && SECRET[j] == p[i+j]) {j++;} lpref = max(lpref, j); } return lpref; } int main() { cout << guess_sequence(SECRET.length()) << '\n'; } #endif

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

/usr/bin/ld: /tmp/ccLZhcYD.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/cczvl0HV.o:combo.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccLZhcYD.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cczvl0HV.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status