제출 #592354

#제출 시각아이디문제언어결과실행 시간메모리
592354JJAnawat콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.cpp" using namespace std; string button[4]={"A","B","X","Y"}; string guess_sequence(int N) { string ans=""; if(press("AB")){ ans=(press("A"))?"A":"B"; } else{ ans=(press("X"))?"X":"Y"; } if(N==1) return ans; vector<string> rd; for(int i=0;i<4;i++){ if(button[i]!=ans) rd.push_back(button[i]); } for(int i=1;i<N-1;i++){ int scr=press(ans+rd[0]+ans+rd[1]+rd[0]+ans+rd[1]+rd[1]+ans+rd[1]+rd[2]); //AB AXB AXY AXZ //else AY int sz=ans.size(); if(scr==sz+1) ans+=rd[0]; else if(scr==sz+2) ans+=rd[1]; else ans+=rd[2]; } if(press(ans+rd[0]+ans+rd[1])==ans.size()+1){ if(press(ans+rd[0])-ans.size()) ans+=rd[0]; else ans+=rd[1]; } else ans+=rd[2]; return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     if(press(ans+rd[0]+ans+rd[1])==ans.size()+1){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccIYla7l.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/ccqXLupm.o:combo.cpp:(.text+0x100): first defined here
/usr/bin/ld: /tmp/ccIYla7l.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccqXLupm.o:combo.cpp:(.text.startup+0xc0): first defined here
collect2: error: ld returned 1 exit status