QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#876406 | #7703. Base Hi-Lo Game | WeaRD276# | WA | 1ms | 3712kb | C++20 | 2.5kb | 2025-01-30 20:52:19 | 2025-01-30 20:52:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<db, db> pdd;
typedef pair<ll, ll> pll;
string alf = "";
void pre()
{
for (char ch = '0'; ch <= '9'; ch++)
alf += ch;
for (char ch = 'A'; ch <= 'Z'; ch++)
alf += ch;
for (char ch = 'a'; ch <= 'z'; ch++)
alf += ch;
}
string ask(string num)
{
cout << num << endl;
string resp;
cin >> resp;
return resp;
}
int solve(int b)
{
string al = alf.substr(0, b);
//int m = sz(al);
int d;
cin >> d;
vector<int> mxs(d, b);
vector<int> mns(d, -1);
vector<int> know(d, -1);
while (true)
{
string str = "";
FOR (i, 0, d)
{
int mid = (mxs[i] + mns[i]) / 2;
str += al[mid];
}
string resp = ask(str);
if (resp == "correct")
{
return 0;
}
if (sz(resp) != d)
{
cout << "cheater" << endl;
return 0;
}
//assert(sz(resp) == d);
FOR (i, 0, d)
{
int mn = mns[i], mx = mxs[i];
int mid = (mn + mx) / 2;
if (resp[i] == '=')
{
if (know[i] != -1 && know[i] != mid)
{
cout << "cheater" << endl;
return 0;
}
know[i] = mid;
mns[i] = mxs[i] = mid;
}
else if (resp[i] == '+')
{
if (know[i] != -1)
{
cout << "cheater" << endl;
return 0;
}
mns[i] = mid;
}
else if (resp[i] == '-')
{
if (know[i] != -1)
{
cout << "cheater" << endl;
return 0;
}
mxs[i] = mid;
}
else
{
cout << "cheater" << endl;
return 0;
}
//assert(false);
}
}
return 0;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
pre();
int TET = 1e9;
int b;
cin >> b >> TET;
for (int i = 1; i <= TET; i++)
{
if (solve(b))
{
break;
}
#ifdef ONPC
cerr << "_____________________________\n";
#endif
}
#ifdef ONPC
cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
#endif
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3712kb
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: 3584kb
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
Wrong Answer
time: 0ms
memory: 3584kb
input:
10 6 3 --+ =++ =++ =+= =+=
output:
444 117 128 139 139 139
result:
wrong answer Didn't get to correct answer in 5 guesses (test case 1)