Submission #1195658

#TimeUsernameProblemLanguageResultExecution timeMemory
1195658Cebrayil09Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back //string answer = "YBXXAB"; int press(string s) { /*int mx = 0; for(int i = 0;i < s.size();i++) { if(s[i] == answer[0]) { int res = 1; for(int j = i+1;j < s.size();j++) { if(s[j] != answer[j-i]) break; res++; } mx = max(mx, res); } } return mx;*/ } string guess_sequence(int n) { vector<string> v = {"A", "B", "X", "Y"}; string s; if(press("AB")) { if(press("A")) { s = "A"; swap(v[0], v[3]); } else { s = "B"; swap(v[1], v[3]); } } else { if(press("X")) { s = "X"; swap(v[2], v[3]); } else { s = "Y"; } } v.pop_back(); for(auto &p : v) cout << p << " "; cout << "\n"; for(int i = 2;i <= n;i++) { string test = s + v[0] + s + v[1]; if(press(test) == i) { if(press(s+v[0]) == i) { s += v[0]; continue; } s += v[1]; continue; } s += v[2]; } return s; } /*int main() { cout << guess_sequence(answer.size()); }*/

Compilation message (stderr)

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