Submission #1066712

#TimeUsernameProblemLanguageResultExecution timeMemory
1066712Muhammad_Aneeq콤보 (IOI18_combo)C++17
0 / 100
1 ms596 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; char d[4]={'A','B','X','Y'}; map<string,int>vis; int ask(string x) { if (vis.find(x)==vis.end()) vis[x]=press(x); return vis[x]; } string guess_sequence(int N) { srand(time(0)); string init=""; if (N==1) { for (int i=0;i<3;i++) { init+=d[i]; if (ask(init)) break; init.pop_back(); } if (init.size()==0) init+=d[3]; return init; } string g="BXBYBAA"; if (ask(g)==1) init+='A'; else if (ask(g)==0) { g="YAYBYXX"; if (ask(g)==2) init+='X'; else init+='X'; } else init+='B'; vector<int>c; for (int i=0;i<4;i++) { if (init[0]==d[i]) continue; c.push_back(d[i]); } for (int i=1;i<N;i++) { if (i!=N-1) { string z; z+=init; z+=c[0]; string g; g+=init; g+=c[1]; for (int j=0;j<3;j++) z+=g,z+=c[j]; int sz=ask(z); if (sz==i) init+=c[2]; if (sz==i+1) init+=c[0]; if (sz==i+2) init+=c[1]; } else { for (int j=0;j<2;j++) { init+=c[j]; if (ask(init)==i+1) break; init.pop_back(); } if (init.size()==i) init+=c[2]; } } return init; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:78:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   78 |    if (init.size()==i)
      |        ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...