Submission #156405

#TimeUsernameProblemLanguageResultExecution timeMemory
156405InfiniteJestCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <fstream> #include <vector> #include <queue> #include <algorithm> #include <math.h> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ifstream in("input.txt"); ofstream out("output.txt"); typedef long long ll; int n; string g; string s; vector<string> p; int press(string p){ int mas=-1; for(int i=0;i<p.length();i++){ string f=""; for(int y=i;y<p.length();y++){ //cout<<"i "<<i<<" y "<<y<<endl; f+=p[y]; if(f==g.substr(0,y-i+1))mas=max(mas,y-i+1); } } return mas; } string guess_sequence(int N){ n=N; if(press("AB")>=1){ if(press("A")>=1)s+="A"; else s+="B"; } else{ if(press("X")>=1)s+="X"; else s+="Y"; } if(s[0]!='A')p.pb("A"); if(s[0]!='B')p.pb("B"); if(s[0]!='X')p.pb("X"); if(s[0]!='Y')p.pb("Y"); for(int i=1;i<=n-2;i++){ int k=press(s+p[0]+s+p[1]+p[0]+s+p[1]+p[2]+s+p[1]+p[1]); if(k==i+1){ s+=p[0]; } else if(k>i+1){ s+=p[1]; } else{ s+=p[2]; } } if(press(s+p[0]+s+p[1])==n){ if(press(s+p[0])==n)s+=p[0]; else s+=p[1]; } else{ s+=p[2]; } return s; }

Compilation message (stderr)

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