QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321685#7703. Base Hi-Lo Gameishmeal#AC ✓1ms3684kbC++231.0kb2024-02-05 06:46:482024-02-05 06:46:49

Judging History

你现在查看的是最新测评结果

  • [2024-02-05 06:46:49]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3684kb
  • [2024-02-05 06:46:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
// 32

int b;
string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

void run() {
	int d; cin >> d;
	vector<pair<int,int>> digits(d, {0,b});
	assert(s.size() == 62);

	while (1) {
		for (auto [l,r] : digits) cout << s[(l+r)/2];
		cout << endl;

		string t; cin >> t;
		if (t == "correct") return;
		// t is empty
		assert(t.size() == (unsigned)d or t.empty());
		if (count(t.begin(), t.end(), '=') == t.size()) {
			cout << "cheater" << endl;
			cin >> t;
			assert(t == "correct");
			return;
		}

		for (int i = 0; i < d; i++) {
			int m = (digits[i].first + digits[i].second) / 2;
			if (t[i] == '+') digits[i].first = m+1;
			else if (t[i] == '-') digits[i].second = m;
			else digits[i].first = m, digits[i].second = m+1;

			if (digits[i].first >= digits[i].second) {
				cout << "cheater" << endl;
				cin >> t;
				assert(t == "correct");
				return;
			}
		}
	}
}

int main() {
	cin.tie(0)->sync_with_stdio(0);

	int n; cin >> b >> n;
	while (n--) run();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3616kb

input:

10 2
5
----=
-=++=
==-==
correct
6
--++-+
=+-=-+
==-=-=
correct

output:

55555
22225
12445
12345
555555
228828
247819
246809

result:

ok correct (2 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

38 2
1
+
+
+
+
correct
3
---
+-=
--=
--=
--=
correct

output:

J
T
Y
a
b
JJJ
999
E49
C29
B19
A09

result:

ok correct (2 test cases)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

10 6
3
-++
--+
=-=
=-=
correct
3
-=+
-++
correct
5
++++=
+=--=
===-+
correct
4
----
====
correct
4
++++
++++
====
correct
4
====
correct

output:

555
288
179
169
cheater
555
258
cheater
55555
88885
98775
cheater
5555
2222
cheater
5555
8888
9999
cheater
5555
cheater

result:

ok correct (6 test cases)

Test #4:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

62 2
4
====
correct
64
================================================================
correct

output:

VVVV
cheater
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
cheater

result:

ok correct (2 test cases)

Test #5:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

10 10
2
-=
--
correct
2
-=
--
correct
2
-=
--
correct
2
-=
--
correct
2
-=
--
correct
2
-+
--
=-
=-
correct
2
--
-+
=+
correct
2
--
-+
=+
correct
2
--
-+
=+
correct
2
--
-+
=+
correct

output:

55
25
cheater
55
25
cheater
55
25
cheater
55
25
cheater
55
25
cheater
55
28
17
16
cheater
55
22
14
cheater
55
22
14
cheater
55
22
14
cheater
55
22
14
cheater

result:

ok correct (10 test cases)

Test #6:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

8 2
2
correct
2
correct

output:

44
44

result:

ok correct (2 test cases)