Submission #95739

#TimeUsernameProblemLanguageResultExecution timeMemory
95739SomeoneUnknownCombo (IOI18_combo)C++14
0 / 100
2 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { if(N == 1){ if(press("AB") == 1){ if(press("A") == 1){ return "A"; }else{ return "B"; } }else{ if(press("X") == 1){ return "X"; }else{ return "Y"; } } } int r = press("ABXAXBA"); string combo = ""; if(r >= 2){ string ord = "ABX"; if(press("ABXA") == 1){ ord = "AXB"; } string p = "A" + ord[1]; switch(press(p)){ case 2: combo = p; break; case 1: combo += ord[1]; combo += ord[2]; break; case 0: combo += ord[2]; combo += ord[0]; break; } }else if(r == 1){ if(press("BX") == 1){ if(press("B") == 1){ combo = "BY"; }else{ combo = "XY"; } }else{ combo = "AY"; } }else if(r == 0){ if(press("YBYX") == 2){ if(press("YB") == 2){ combo = "YB"; }else{ combo = "YX"; } }else{ combo = "YA"; } } vector<char> nfirst; string x = "ABXY"; for(int i = 0; i < 4; i++){ if(combo[0] != x[i]){ nfirst.push_back(x[i]); } } if(N == 2){ return combo; } for(int i = 2; i < N-1; i++){ string ask = combo + x[1]; for(int i = 0; i < 3; i++){ ask += combo + x[2]; ask += x[i]; } int l = combo.length(); combo += x[press(ask)-l]; } if(combo.length() == press(combo + x[0])){ return combo + x[0]; } if(combo.length() == press(combo + x[1])){ return combo + x[1]; } return combo + x[2]; /*std::string p = ""; /*for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); std::string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; } return S;//*/ }

Compilation message (stderr)

combo.cpp:81:3: warning: "/*" within comment [-Wcomment]
   81 |   /*for (int i = 0; i < 4 * N; ++i) {
      |    
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:73:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   73 |     if(combo.length() == press(combo + x[0])){
      |        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
combo.cpp:76:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   76 |     if(combo.length() == press(combo + x[1])){
      |        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...