Submission #1071006

#TimeUsernameProblemLanguageResultExecution timeMemory
1071006TobCombo (IOI18_combo)C++14
100 / 100
44 ms1820 KiB
#include <bits/stdc++.h>

#include "combo.h"

using namespace std;
 
string guess_sequence(int n) {
	string c = "ABXY";
	vector <int> v = {0, 1, 2, 3};
	string s;
	int o;
	if (press("AB")) o = press("B");
	else o = 2+press("Y");
	s += c[o];
	v.erase(v.begin()+o, v.begin()+o+1);
	for (int i = 1; i < n; i++) {
		string t;
		if (i == n-1) {
			for (int j = 0; j < i; j++) t += s[j]; t += c[v[0]];
			for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
			if (press(t) == i) s += c[v[2]];
			else s += c[v[press(t.substr(n, n))-i]];
			continue;
		}
		for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
		for (int k = 0; k < 3; k++) {
			for (int j = 0; j < i; j++) t += s[j];
			t += c[v[2]]; t += c[v[k]];
		}
		s += c[v[press(t)-i]];
	}
	return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   19 |    for (int j = 0; j < i; j++) t += s[j]; t += c[v[0]];
      |    ^~~
combo.cpp:19:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   19 |    for (int j = 0; j < i; j++) t += s[j]; t += c[v[0]];
      |                                           ^
combo.cpp:20:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |    for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
      |    ^~~
combo.cpp:20:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   20 |    for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
      |                                           ^
combo.cpp:25:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   25 |   for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
      |   ^~~
combo.cpp:25:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   25 |   for (int j = 0; j < i; j++) t += s[j]; t += c[v[1]];
      |                                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...