Submission #78795

#TimeUsernameProblemLanguageResultExecution timeMemory
78795patcasraresCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<iostream> //#include "combo.h" using namespace std; int press(string s) { int r; cout<<s<<'\n'; cin>>r; return r; } string guess_sequence(int N) { int r,poz=0,cnt=-1,n=N; string a[3],cand[4]={"A","B","X","Y"}; string q,rez; q="AB"; r=press(q); if(r) poz=0; else poz=2; q=cand[poz]; r=press(q); if(r==0) poz++; for(int i=0;i<4;i++) if(i!=poz) { cnt++; a[cnt]=cand[i]; } rez=cand[poz]; cnt=1; poz=2; for(int i=2;i<n;i++) { q=rez+a[0]; q=q+rez; q=q+a[1]; q=q+a[0]; q=q+rez; q=q+a[1]; q=q+a[1]; q=q+rez; q=q+a[1]; q=q+a[2]; r=press(q); if(r==i-1) { rez=rez+a[2]; continue; } if(r==i) { rez=rez+a[0]; continue; } rez=rez+a[1]; } q=rez+a[0]; q=q+rez; q=q+a[1]; r=press(q); if(r==n) { q=rez+a[0]; r=press(q); if(r==n) rez=rez+a[0]; else rez=rez+a[1]; } else rez=rez+a[2]; return rez; } int main() { cout<<guess_sequence(5); }

Compilation message (stderr)

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