Submission #719880

#TimeUsernameProblemLanguageResultExecution timeMemory
719880AirCirclesCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define PB push_back typedef vector<int> vec; string S; int press(string p){ int ss=0,best=0; for(int i=0;i<p.length();i++){ if(S[ss]==p[i]){ ss++; }else{ best=max(best,ss); ss=0; } } best=max(best,ss); return best; } string guess_sequence(int N){ string s=""; char a,b,c,d; if(press("AB")>0){ if(press("A")==1){ a='A';b='B';c='X';d='Y'; }else{ a='B';b='A';c='X';d='Y'; } }else{ if(press("X")==1){ a='X';b='B';c='A';d='Y'; }else{ a='Y';b='B';c='X';d='A'; } } s+=a; for(int l=1;l<N-1;l++){ int coin=press(s+c+s+d+b+s+d+c+s+d+d); if(coin==l){ s+=b; }else{ if(coin==l+1){ s+=c; }else{ s+=d; } } } if(N>1){ int coin=press(s+b+s+c); if(coin==N){ if(press(s+b)==N){ s+=b; }else{ s+=c; } }else{ s+=d; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'int press(std::string)':
combo.cpp:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<p.length();i++){
      |                 ~^~~~~~~~~~~
/usr/bin/ld: /tmp/ccYr4UNI.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/cc1UXM0K.o:combo.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status