Submission #1006864

#TimeUsernameProblemLanguageResultExecution timeMemory
1006864adrielcpCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() int press(string hm) { cout << hm << endl; int ans;cin>>ans; return ans; } string S = "ABXY"; char getpatokan() { int res1 = press("AB"), res2 = press("BX"); if (res1 && res2) return 'B'; else if (res1) return 'A'; else if (res2) return 'X'; else return 'Y'; } // ABXYBYYXB // patokan: A // BXYBYYXB // ABAX // AXAY // string guess_sequence(int n) { char patokan = getpatokan(); set<char> st{'A', 'B', 'X', 'Y'}; st.erase(patokan); string now; now += patokan; for (int i = 0; i < n-1; i++) { auto it = st.begin(); int idx = rand()%3; char gok = 'O'; char top; for (int j = 0; j < 3; j++) { char x = *it; it++; if (j == idx) { top = x; continue; } if (press(now + x) == now.length()+1) { gok = x; break; } } if (gok == 'O') now += top; else now += gok; } return now; } int main() { int n;cin>>n; cout << guess_sequence(n) << endl; } // string guess_sequence(int N) { // string permu = "AAAABBBBXXXXYYYY"; // do { // cout << permu << endl; // } while (next_permutation(all(permu))); // }

Compilation message (stderr)

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