QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#331958#7703. Base Hi-Lo Gamecry#TL 1ms3644kbC++142.9kb2024-02-19 01:02:532024-02-19 01:02:53

Judging History

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

  • [2024-02-19 01:02:53]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3644kb
  • [2024-02-19 01:02:53]
  • 提交

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;
		while(true) {
			bool change = false;
			for(array<int, 2> i : v) {
				if(i[0] != i[1]) {
					change = true;
				}
			}
			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) {
			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: 1ms
memory: 3588kb

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: 0ms
memory: 3644kb

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: -100
Time Limit Exceeded

input:

10 6
3
--+
=++
=++
=+=
correct
3
-++
==+
=-+
=-=
=-=

output:

444
117
128
139
cheater
444
177
178
169
169
169

result: