제출 #1323458

#제출 시각아이디문제언어결과실행 시간메모리
1323458_airaCombo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define ff first #define ss second #define all(a) a.begin(),a.end() #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define fios(); ios_base::sync_with_stdio(0);cin.tie(0); #define file(); freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); int press(string p); string guess_sequence(int N){ string ans="",s=""; if(press("AB")!=0) { if(press("A")==1){ ans="A"; s="BXY"; }else{ ans="B"; s="AXY"; } } else if(press("X")==1) { ans="X"; s="ABY"; } else { ans="Y"; s="ABX"; } if(N==1) return ans; for(int i=2;i<=N;i++){ if(i==N){ if(press(ans+s[0])==N){ ans+=s[0]; } else{ ans+=s[1]; } continue; } int k=press(ans+s[0]+ans+s[1]+s[0]+ans+s[1]+s[1]+ans+s[1]+s[2]); if(k==ans.size()+1){ ans+=s[0]; } else if(k==ans.size()+2){ ans+=s[1]; } else ans+=s[2]; } return ans; } // int call=0; int press(string p){ cout<<p<<endl; cout.flush(); int k; cin>>k; call++; return k; } void solve(){ string str; cin>>str; cout<<guess_sequence(str.size())<<endl; cout.flush(); cout<<call<<endl; cout.flush(); return; } int32_t main(){ fios(); solve(); return 0; }

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

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