Submission #903913

#TimeUsernameProblemLanguageResultExecution timeMemory
903913zhasynCombo (IOI18_combo)C++14
0 / 100
1 ms368 KiB
#include "combo.h"
#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
using namespace std;
#define F first
#define S second
typedef long long ll;
#define pii pair <int, int>
#define pll pair <ll, ll>
typedef long double ld;
const ll N = 2 * 1e5 + 10, len = 316;
const ll mod = 1e9 + 7;

ll um(ll a, ll b){
	return ((1LL * a * b) % mod + mod) % mod;
}
ll subr(ll a, ll b){
	return ((1LL * a - b) % mod + mod) % mod;
}
string check, s = "ABXY";
int fir, n1, n2, n3;
void create(int cur, int sz, string next){
	if(cur == sz){
		check += next;
		return;
	}
	create(cur + 1, sz, next + s[n1]);
	create(cur + 1, sz, next + s[n2]);
}
string guess_sequence(int n){
	n1 = n2 = n3 = -1;
	if(press("AB") >= 1){
		if(press("A") == 1) fir = 0;
		else fir = 1;
	} else{
		if(press("X") == 1) fir = 2;
		else fir = 3;
	}
	string ans = "";
	ans += s[fir];
	int cur = 1;
	for(int i = 0; i < 4; i++){
		if(i == fir) continue;
		if(n1 == -1) n1 = i;
		else{
			if(n2 == -1) n2 = i;
			else n3 = i;
		}
	}
	for(int i = 1; i < n; i++){
		string check = ans + s[n1] + ans + s[n2] + s[n1];
		check = check + ans + s[n2] + s[n2] + ans + s[n2] + s[n3];
		int res = press(check);
		if(res == i + 1) ans += s[n1];
		else{
			if(res == i + 2) ans += s[n2];
			else ans += s[n3];
		}
	}
	return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:6: warning: unused variable 'cur' [-Wunused-variable]
   42 |  int cur = 1;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...