QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#874655#2742. ComboAlimkhan#5 14ms4096kbC++231.3kb2025-01-28 13:03:322025-01-28 13:03:34

Judging History

This is the latest submission verdict.

  • [2025-01-28 13:03:34]
  • Judged
  • Verdict: 5
  • Time: 14ms
  • Memory: 4096kb
  • [2025-01-28 13:03:32]
  • 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 <= 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: 5
Accepted

Test #1:

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

input:

ABB

output:

Accepted: 3

result:

points 1.0 Correct

Test #2:

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

input:

ABX

output:

Accepted: 4

result:

points 1.0 Correct

Test #3:

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

input:

ABY

output:

Accepted: 4

result:

points 1.0 Correct

Test #4:

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

input:

AXB

output:

Accepted: 3

result:

points 1.0 Correct

Test #5:

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

input:

AXX

output:

Accepted: 4

result:

points 1.0 Correct

Test #6:

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

input:

AXY

output:

Accepted: 4

result:

points 1.0 Correct

Test #7:

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

input:

AYB

output:

Accepted: 3

result:

points 1.0 Correct

Test #8:

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

input:

AYX

output:

Accepted: 4

result:

points 1.0 Correct

Test #9:

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

input:

AYY

output:

Accepted: 4

result:

points 1.0 Correct

Test #10:

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

input:

BAA

output:

Accepted: 4

result:

points 1.0 Correct

Test #11:

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

input:

BAX

output:

Accepted: 5

result:

points 1.0 Correct

Test #12:

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

input:

BAY

output:

Accepted: 5

result:

points 1.0 Correct

Test #13:

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

input:

BXA

output:

Accepted: 4

result:

points 1.0 Correct

Test #14:

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

input:

BXX

output:

Accepted: 5

result:

points 1.0 Correct

Test #15:

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

input:

BXY

output:

Accepted: 5

result:

points 1.0 Correct

Test #16:

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

input:

BYA

output:

Accepted: 4

result:

points 1.0 Correct

Test #17:

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

input:

BYX

output:

Accepted: 5

result:

points 1.0 Correct

Test #18:

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

input:

BYY

output:

Accepted: 5

result:

points 1.0 Correct

Test #19:

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

input:

XAA

output:

Accepted: 5

result:

points 1.0 Correct

Test #20:

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

input:

XAB

output:

Accepted: 6

result:

points 1.0 Correct

Test #21:

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

input:

XAY

output:

Accepted: 6

result:

points 1.0 Correct

Test #22:

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

input:

XBA

output:

Accepted: 5

result:

points 1.0 Correct

Test #23:

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

input:

XBB

output:

Accepted: 6

result:

points 1.0 Correct

Test #24:

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

input:

XBY

output:

Accepted: 6

result:

points 1.0 Correct

Test #25:

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

input:

XYA

output:

Accepted: 5

result:

points 1.0 Correct

Test #26:

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

input:

XYB

output:

Accepted: 6

result:

points 1.0 Correct

Test #27:

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

input:

XYY

output:

Accepted: 6

result:

points 1.0 Correct

Test #28:

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

input:

YAA

output:

Accepted: 5

result:

points 1.0 Correct

Test #29:

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

input:

YAB

output:

Accepted: 6

result:

points 1.0 Correct

Test #30:

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

input:

YAX

output:

Accepted: 6

result:

points 1.0 Correct

Test #31:

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

input:

YBA

output:

Accepted: 5

result:

points 1.0 Correct

Test #32:

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

input:

YBB

output:

Accepted: 6

result:

points 1.0 Correct

Test #33:

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

input:

YBX

output:

Accepted: 6

result:

points 1.0 Correct

Test #34:

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

input:

YXA

output:

Accepted: 5

result:

points 1.0 Correct

Test #35:

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

input:

YXB

output:

Accepted: 6

result:

points 1.0 Correct

Test #36:

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

input:

YXX

output:

Accepted: 6

result:

points 1.0 Correct

Subtask #2:

score: 0
Wrong Answer

Test #37:

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

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: 0ms
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: 95
Accepted
time: 0ms
memory: 3840kb

input:

AX

output:

Accepted: 3

result:

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

Test #43:

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

input:

AY

output:

Accepted: 3

result:

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

Test #44:

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

input:

BA

output:

Accepted: 3

result:

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

Test #45:

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

input:

BX

output:

Accepted: 4

result:

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

Test #46:

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

input:

BY

output:

Accepted: 4

result:

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

Test #47:

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

input:

XA

output:

Accepted: 4

result:

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

Test #48:

score: 92
Acceptable Answer
time: 1ms
memory: 3840kb

input:

XB

output:

Accepted: 5

result:

points 0.96842105260 Accepable. Query Count: 5 (in the range (n+2,n+10]).

Test #49:

score: 92
Acceptable Answer
time: 1ms
memory: 3840kb

input:

XY

output:

Accepted: 5

result:

points 0.96842105260 Accepable. Query Count: 5 (in the range (n+2,n+10]).

Test #50:

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

input:

YA

output:

Accepted: 4

result:

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

Test #51:

score: 92
Acceptable Answer
time: 0ms
memory: 3840kb

input:

YB

output:

Accepted: 5

result:

points 0.96842105260 Accepable. Query Count: 5 (in the range (n+2,n+10]).

Test #52:

score: 92
Acceptable Answer
time: 0ms
memory: 3840kb

input:

YX

output:

Accepted: 5

result:

points 0.96842105260 Accepable. Query Count: 5 (in the range (n+2,n+10]).

Test #53:

score: 0
Wrong Answer
time: 14ms
memory: 4096kb

input:

YXBBXXAXXBAXXXAABBBAABBBBBAABAAXAAXBBBXABBXBABABXBXBXAXAXBAAXAXXXAABXBXXXAXAXABXBBBBAXBBABBXXXAXBXABXAXAAXAXBABXAABXBAAAAAXXXABXXBAXBABAXXABAXAXAABBXBXBBBAXXXXXAABXAXAABBAABBAXXXBXXABAXXABAABXAAXABBXXBXBABXBABAABXXBABXXBBBXAXABBBXXAAABBAXABBABBXBAAAXBBXBBBBBXBXAXBXXAABBXABABAXBAAABBBAAAXXAAAXXABBXXA...

output:

Wrong Answer: wrong guess

result:

wrong answer