제출 #440282

#제출 시각아이디문제언어결과실행 시간메모리
440282julian33콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define deb(...) logger(#__VA_ARGS__, __VA_ARGS__) template<typename ...Args> void logger(string vars, Args&&... values) { cerr<<vars<<" = "; string delim=""; (...,(cerr<<delim<<values,delim=", ")); cerr<<"\n"; } #else #define deb(...) logger(#__VA_ARGS__, __VA_ARGS__) template<typename ...Args> void logger(string vars, Args&&... values) {} #endif #define pb push_back #define sz(x) (int)(x.size()) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; template<typename T> inline void maxa(T& a,T b){a=max(a,b);} template<typename T> inline void mina(T& a,T b){a=min(a,b);} int press(string p){ // deb(p); // string pref=S; // while(sz(pref)){ // if(p.find(pref)!=string::npos){ // deb(pref); // return sz(pref); // } // pref.pop_back(); // } // return 0; } string guess_sequence(int N){ string res=""; while(sz(res)!=N){ int num=press(res+'A'+res+'B'); if(num>sz(res)){ int a=press(res+'A'); if(a>sz(res)) res+='A'; else res+='B'; } else{ int x=press(res+'X'); if(x>sz(res)) res+='X'; else res+='Y'; } } return res; }

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

combo.cpp: In function 'int press(std::string)':
combo.cpp:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
   39 | }
      | ^
/usr/bin/ld: /tmp/cc08QXkR.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/ccgSyFkR.o:combo.cpp:(.text.unlikely+0x0): first defined here
collect2: error: ld returned 1 exit status