QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#874651#2742. ComboAlimkhan#0 1ms3840kbC++231.3kb2025-01-28 12:58:262025-01-28 12:58:28

Judging History

This is the latest submission verdict.

  • [2025-01-28 12:58:28]
  • Judged
  • Verdict: 0
  • Time: 1ms
  • Memory: 3840kb
  • [2025-01-28 12:58:26]
  • Submitted

answer

#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

char a[10], cnt;
char f;
vector <char> v;

char findfirst() {
	string s;
	s = a[1];
	int x = press(s);
	if (x == 1) {
		return a[1];
	}
	s = a[2];
	x = press(s);
	if (x == 1) {
		return a[2];
	}
	s = a[3];
	x = press(s);
	if (x == 1) {
		return a[3];
	}
	return a[4];
}

std::string guess_sequence(int N) {
	int n = N;
	a[1] = 'A';
	a[2] = 'B';
	a[3] = 'X';
	a[4] = 'Y';
	f = findfirst();
	string s;
	s += f;
	cnt = 1;
	if (n == 1) {
		return s;
	}
	for (int i = 1; i <= n; i++) {
		if (a[i] != f) {
			v.push_back(a[i]);
		}
	}
	while(s.size() + 1 < n) {
		string s1 = s;
		string s2 = s;
		string s3 = s;
		string s4 = s;
		cnt = s.size();
		string q;
		s1 += v[0];
		s2 += v[0];
		s3 += v[0];
		s1 += v[0];
		s2 += v[1];
		s3 += v[2];
		s4 += v[1];
		q += s1;
		q += s2;
		q += s3;
		q += s4;
		int x = press(q);
		if (x == cnt + 2) {
			s += v[0];
			continue;
		}
		if (x == cnt + 1) {
			s += v[1];
			continue;
		}
		s += v[2];
	}
	string s1 = s;
	string s2 = s;
	string s3 = s;
	s1 += v[0];
	s2 += v[1];
	s3 += v[2];
	int x = press(s1);
	if (x == n) {
		return s1;
	}
	x = press(s2);
	if (x == n) {
		return s2;
	}
	return s3;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3840kb

input:

ABB

output:

Wrong Answer: invalid press

result:

wrong answer 

Subtask #2:

score: 0
Wrong Answer

Test #37:

score: 95
Accepted
time: 0ms
memory: 3712kb

input:

A

output:

Accepted: 1

result:

points 1.0 Correct. Query Count: 1 (no more than n+2).

Test #38:

score: 95
Accepted
time: 0ms
memory: 3840kb

input:

B

output:

Accepted: 2

result:

points 1.0 Correct. Query Count: 2 (no more than n+2).

Test #39:

score: 95
Accepted
time: 0ms
memory: 3840kb

input:

X

output:

Accepted: 3

result:

points 1.0 Correct. Query Count: 3 (no more than n+2).

Test #40:

score: 95
Accepted
time: 1ms
memory: 3840kb

input:

Y

output:

Accepted: 3

result:

points 1.0 Correct. Query Count: 3 (no more than n+2).

Test #41:

score: 95
Accepted
time: 0ms
memory: 3840kb

input:

AB

output:

Accepted: 2

result:

points 1.0 Correct. Query Count: 2 (no more than n+2).

Test #42:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

AX

output:

Wrong Answer: invalid press

result:

wrong answer