제출 #864032

#제출 시각아이디문제언어결과실행 시간메모리
864032dpsaveslives콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; int press(string p){ cout << p << "\n"; int ok; cin >> ok; return ok; } string guess_sequence(int N){ vector<int> mp = {'A','B','X','Y'}; string s = ""; int p; int r = press("AB"); if(r == 0){ r = press("X"); if(r == 0){ s += "Y"; p = 3; } else{ s += "X"; p = 2; } } else if(r == 1){ r = press("A"); if(r == 0){ s += "B"; p = 1; } else{ s += "A"; p = 0; } } else{ p = 0; s += "A"; } for(int i = 1;i<N;++i){ string cur = ""; for(int j = 0;j<4;++j){ if(j != p){ cur += s; cur += mp[(p+1)%4]; cur += mp[j]; } } cur += s; cur += mp[(p+2)%4]; int r = press(cur); if(r == i){ s += mp[(p+3)%4]; } else if(r == i+1){ s += mp[(p+2)%4]; } else{ s += mp[(p+1)%4]; } cout << s << "\n"; } return s; } int main() { string s = guess_sequence(5); //ABXYY cout << s << "\n"; return 0; }

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

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