QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#874816#2742. ComboAlimkhan0 0ms3840kbC++231.3kb2025-01-28 17:21:352025-01-28 17:21:36

Judging History

This is the latest submission verdict.

  • [2025-01-28 17:21:36]
  • Judged
  • Verdict: 0
  • Time: 0ms
  • Memory: 3840kb
  • [2025-01-28 17:21:35]
  • Submitted

answer

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

using namespace std;

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

char findfirst() {
	string s;
	s += a[1];
	s += a[2];
	int x = press(s);
	if (x == 1) {
		string s2;
		s2 += a[1];
		x = press(s2);
		if (x == 1) {
			return a[1];
		}
		return a[2];
	}
	string s2;
	s2 += a[3];
	x = press(s2);
	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 <= 4; 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;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

ABB

output:

Wrong Answer: wrong guess

result:

wrong answer 

Subtask #2:

score: 0
Wrong Answer

Test #37:

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

input:

A

output:

Accepted: 2

result:

points 1.0 Correct. Query Count: 2 (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: 2

result:

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

Test #40:

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

input:

Y

output:

Accepted: 2

result:

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

Test #41:

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

input:

AB

output:

Wrong Answer: wrong guess

result:

wrong answer