QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#331960#7703. Base Hi-Lo Gamecry#AC ✓1ms3780kbC++143.1kb2024-02-19 01:06:312024-02-19 01:06:32

Judging History

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

  • [2024-02-19 01:06:32]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3780kb
  • [2024-02-19 01:06:31]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

map<char, string> mp;

void envy(){
	mp['A'] = "01";
	mp['B'] = "1000";
	mp['C'] = "1010";
	mp['D'] = "100";
	mp['E'] = "0";
	mp['F'] = "0010";
	mp['G'] = "110";
	mp['H'] = "0000";
	mp['I'] = "OO";
	mp['J'] = "0111";
	mp['K'] = "101";
	mp['L'] = "0100";
	mp['M'] = "11";
	mp['N'] = "10";
	mp['O'] = "111";
	mp['P'] = "0110";
	mp['Q'] = "1101";
	mp['R'] = "010";
	mp['S'] = "000";
	mp['T'] = "1";
	mp['U'] = "001";
	mp['V'] = "0001";
	mp['W'] = "011";
	mp['X'] = "1001";
	mp['Y'] = "1011";
	mp['Z'] = "1100";
	mp['0'] = "11111";
	mp['1'] = "01111";
	mp['2'] = "00111";
	mp['3'] = "00011";
	mp['4'] = "00001";
	mp['5'] = "00000";
	mp['6'] = "10000";
	mp['7'] = "11000";
	mp['8'] = "11100";
	mp['9'] = "11110";
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	envy();
	int B; int N;
	cin >> B >> N;
	string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	for(int i = 0; i < N; i++) {
		int D; cin >> D;
		vector<array<int, 2>> v(D, {0, B - 1});
		bool ok = false;
		bool cheat = false;
		while(true) {
			bool change = false;
			for(array<int, 2> i : v) {
				if(i[0] != i[1]) {
					change = true;
				} 
				if(i[0] > i[1]) {
					cheat = true;
					break;
				}
			}
			if(cheat) {
				break;
			}
			if(!change) {
				break;
			}
			string s2 = "";
			vector<int> mid(D);
			for(int j = 0; j < D; j++) {
				mid[j] = (v[j][0] + v[j][1]) / 2;
				s2 += s[mid[j]];
			}
			cout << s2 << endl;
			string res; cin >> res;
			if(res == "correct") {
				ok = true;
				break;
			} else {
				for(int j = 0; j < D; j++) {
					if(res[j] == '=') {
						v[j] = {mid[j], mid[j]};
					} else if(res[j] == '+') {
						v[j][0] = mid[j] + 1;
					} else {	
						v[j][1] = mid[j] - 1;
					}
				}
			}
		}
		if(!ok) {
			if(cheat) {
				cout << "cheater" << endl;
				string res; cin >> res;
			} else {
				string s2 = "";
				for(int j = 0; j < D; j++) {
					s2 += s[v[j][0]];
				}
				cout << s2 << endl;
				string res; cin >> res;
				if(res != "correct") {
					cout << "cheater" << endl;
					string res; cin >> res;
				}
			}
		}
	}
}

	// string s; cin >> s;
	// int n = s.size();
	// for(int i = 0; i < n - 1; i++){
	// 	if(s[i] == 'O' && s[i + 1] == 'O'){
	// 		cout << "INVALID" << endl;
	// 		return 0;
	// 	}
	// }
	// if(s.back() != 'O'){
	// 	cout << "INVALID" << endl;
	// 	return 0;
	// }
	// for(ll start = 3; start < 1000; start += 2){
	// 	ll res = start;
	// 	bool ok = true;
	// 	for(int i = n - 2; i >= 0; i--){
	// 		if(s[i] == 'E'){
	// 			res *= 2;
	// 		}
	// 		else{
	// 			res--;
	// 			if(res % 3 != 0){
	// 				ok = false;
	// 				break;
	// 			}
	// 			res /= 3;
	// 		}
	// 		if(s[i] == 'E' && res % 2 == 1){
	// 			ok = false;
	// 			break;
	// 		}
	// 		if(s[i] == 'O' && res % 2 == 0){
	// 			ok = false;
	// 			break;
	// 		}
	// 		if(__builtin_popcountll(res) == 1){
	// 			ok = false;
	// 			break;
	// 		}
	// 	}
	// 	if(ok){
	// 		cout << res << "\n";
	// 	//	break;
	// 	}
	// }

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3780kb

input:

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

output:

44444
11147
12245
12345
444444
147717
245808
246809

result:

ok correct (2 test cases)

Test #2:

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

input:

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

output:

I
S
X
Z
a
b
III
888
D3D
A1A
A09

result:

ok correct (2 test cases)

Test #3:

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

input:

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

output:

444
117
128
139
cheater
444
177
178
cheater
44444
77777
88755
98766
cheater
4444
1111
1111
cheater
4444
7777
8888
8888
cheater
4444
4444
cheater

result:

ok correct (6 test cases)

Test #4:

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

input:

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

output:

UUUU
UUUU
cheater
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
cheater

result:

ok correct (2 test cases)

Test #5:

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

input:

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

output:

44
14
cheater
44
14
cheater
44
14
cheater
44
14
cheater
44
17
15
cheater
44
11
12
13
cheater
44
11
12
13
cheater
44
11
12
13
cheater
44
11
12
13
cheater
44
11
12
13
cheater

result:

ok correct (10 test cases)

Test #6:

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

input:

8 2
2
++
--
correct
2
++
--
correct

output:

33
55
44
33
55
44

result:

ok correct (2 test cases)