Submission #863061

#TimeUsernameProblemLanguageResultExecution timeMemory
863061maks007Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include "bits/stdc++.h" #include "grader.cpp" using namespace std; string guess_sequence(int n) { string str = "", abxy; str += 'A'; if(press(str) == 1) goto end; str.pop_back(); str += 'B'; if(press(str) == 1) goto end; str.pop_back(); str += 'X'; if(press(str) == 1) goto end; str.pop_back(); str += 'Y'; end:; if(str.size() == n) return str; if(str[0] == 'X') abxy = "ABY"; else if(str[0] == 'A') abxy = "BXY"; else if(str[0] == 'Y') abxy = "ABX"; else abxy = "AXY"; while(1) { for(int i = 0; i < abxy.size() - 1; i ++) { str += abxy[i]; if(press(str) == str.size()) goto end2; str.pop_back(); } str += abxy.back(); end2:; if(str.size() == n) return str; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |  if(str.size() == n) return str;
      |     ~~~~~~~~~~~^~~~
combo.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for(int i = 0; i < abxy.size() - 1; i ++) {
      |                  ~~^~~~~~~~~~~~~~~~~
combo.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |    if(press(str) == str.size()) goto end2;
      |       ~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:33:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |   if(str.size() == n) return str;
      |      ~~~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccRtauBE.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/ccQnw7XC.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccRtauBE.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccQnw7XC.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status