제출 #1007138

#제출 시각아이디문제언어결과실행 시간메모리
1007138christinelynn콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() int press(string hm) { cout << hm << endl; int ans;cin>>ans; return ans; } string S = "ABXY"; char getpatokan() { int res1 = press("AB"), res2 = press("BX"); if (res1 && res2) return 'B'; else if (res1) return 'A'; else if (res2) return 'X'; else return 'Y'; } // ABXYBYYXB // patokan: A // BXYBYYXB // guess 2 chars by 2 queries // XX, BX, BY, YB -> 2 // XB, BB, XY, YX -> 1 // XXX // AYY string guess_sequence(int n) { char patokan = getpatokan(); set<char> st{'A', 'B', 'X', 'Y'}; st.erase(patokan); string now; now += patokan; vector<char> a(all(st)); for (int i = 0; i < n-1; i++) { string s; for (int j = 0; j < 3; j++) s += now + a[0] + a[j]; s += now + a[1]; int x = press(s); if (x-now.size() == 0) now += a[2]; else if (x - now.size() == 1) now += a[1]; else now += a[0]; } return now; } int main() { int n;cin>>n; cout << guess_sequence(n) << endl; }

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

/usr/bin/ld: /tmp/ccUAEGn1.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/ccPdYqC2.o:combo.cpp:(.text+0x290): first defined here
/usr/bin/ld: /tmp/ccUAEGn1.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPdYqC2.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status