제출 #677113

#제출 시각아이디문제언어결과실행 시간메모리
677113hello_there_123Combo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "combo.h" using namespace std; string arr[4]={"A","B","X","Y"}; set<string>s; int press(string s){}; string guess_sequence(int N){ string ans = ""; string start = ""; s.insert("A"); s.insert("B"); s.insert("X"); s.insert("Y"); for(int i=0;i<3;i++){ if(press(arr[i]) == 1){ start = arr[i]; break; } } s.erase(start); vector<string>v; for(auto string:s) v.push_back(string); if(start == "") start = "Y"; ans+=start; for(int i=0;i<N-2;i++){ string tr = ""; tr+=ans; tr+=v[0]; tr+=ans; tr+=v[1]; tr+=v[0]; tr+=ans; tr+=v[1]; tr+=v[1]; tr+=ans; tr+=v[1]; tr+=v[2]; if(press(tr) == ans.length()){ ans+=v[2]; } else if(press(tr) == ans.length()+1){ ans+=v[0]; } else ans+=v[1]; } if(press(ans+v[0]) == N) return ans+v[0]; if(press(ans+v[1]) == N) return ans+v[1]; return ans+v[2]; }

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

combo.cpp: In function 'int press(std::string)':
combo.cpp:6:21: warning: no return statement in function returning non-void [-Wreturn-type]
    6 | int press(string s){};
      |                     ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   if(press(tr) == ans.length()){
      |      ~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:41:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   else if(press(tr) == ans.length()+1){
      |           ~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc6aq8NX.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/ccS5URrZ.o:combo.cpp:(.text.unlikely+0x0): first defined here
collect2: error: ld returned 1 exit status