Submission #600671

#TimeUsernameProblemLanguageResultExecution timeMemory
600671enerelt14Combo (IOI18_combo)C++14
5 / 100
1 ms336 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; int n; string guess_sequence(int N){ string ans; n=N; string pp, x; for (int i=0;i<n;i++){ if (i==0){ pp="AB"; if (press(pp)>0){ pp="A"; if (press(pp)>0){ ans="A"; x="BXY"; } else{ ans="B"; x="AXY"; } continue; } pp="X"; if (press(pp)>0){ ans="X"; x="ABY"; } else{ ans="Y"; x="ABX"; } pp.clear(); continue; } if (n==1)return ans; if (i==n-1){ pp=ans+x[0]; if (press(pp)==n){ ans+=x[0]; return ans; } pp=ans+x[1]; if (press(pp)==n){ ans+=x[1]; return ans; } ans+=x[2]; return ans; } pp.clear(); for (int q=0;q<4;q++){ pp+=ans; if (q==3){ pp+=x[0]; for (int j=ans.size()+1;j<n;j++)pp+=ans[0]; break; } pp+=x[1]; pp+=x[q]; for (int j=ans.size()+2;j<n;j++)pp+=ans[0]; } int y=press(pp); if (y==ans.size())ans+=x[2]; if (y==ans.size()+1)ans+=x[0]; if (y==ans.size()+2)ans+=x[1]; pp.clear(); } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:64:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |         if (y==ans.size())ans+=x[2];
      |             ~^~~~~~~~~~~~
combo.cpp:65:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |         if (y==ans.size()+1)ans+=x[0];
      |             ~^~~~~~~~~~~~~~
combo.cpp:66:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |         if (y==ans.size()+2)ans+=x[1];
      |             ~^~~~~~~~~~~~~~
combo.cpp:8:12: warning: control reaches end of non-void function [-Wreturn-type]
    8 |     string pp, x;
      |            ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...