Submission #713234

#TimeUsernameProblemLanguageResultExecution timeMemory
713234ooo콤보 (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
 
string guess_sequence(int n) 
{
 	 string s = "";
	 if(press("AB"))
	 {
	     if(press("A")) s += 'A';
	     else s += 'B';
	 }
	 else
     {
         if(press("X")) s += 'X';
         else s += 'Y';
     }
     string thua = "";
	 if(s[0] != 'A') thua += 'A';
	 if(s[0] != 'B') thua += 'B';
	 if(s[0] != 'X') thua += 'C';
	 if(s[0] != 'Y') thua += 'Y';
	 
	 int len = int(s.size());
	 while(len < n-1)
	 {
	     string temp = s+thua[0]+s+thua[1]+thua[0]+s+thua[1]+thua[2]+s+thua[1]+thua[1];
	     int x = press(temp);
	     if(x == len+1) s += thua[0];
	     else if(x == len+2) s += thua[1];
	     else s += thua[2];
	     
	     len = int(s.size());
	 }
	 
	 if(len == n) return s;
	 if(press(s+thua[0]) == n) return s+thua[0];
	 if(press(s+thua[1]) == n) return s+thua[1];
	 if(press(s+thua[2]) == n) return s+thua[2];
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:15: warning: control reaches end of non-void function [-Wreturn-type]
    7 |    string s = "";
      |               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...