QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#876390 | #7703. Base Hi-Lo Game | WeaRD276# | Compile Error | / | / | C++20 | 2.3kb | 2025-01-30 20:40:08 | 2025-01-30 20:40:09 |
Judging History
This is the latest submission verdict.
- [2025-01-30 20:40:09]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-30 20:40:08]
- Submitted
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++)
al += ch;
for (char ch = 'A'; ch <= 'Z'; ch++)
al += ch;
for (char ch = 'a'; ch <= 'z'; ch++)
al += ch;
}
string ask(string num)
{
cout << num << endl;
string resp;
cin >> resp;
return resp;
}
int solve(int b)
{
string al = afl.substr(0, b);
//int m = sz(al);
int d;
cin >> d;
vector<int> mxs(d, b);
vector<int> mns(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 (mxs[i] < mid || mns[i] > mid)
{
cout << "cheater" << endl;
return 0;
}
if (resp[i] == '=')
{
mns[i] = mxs[i] = mid;
}
else if (resp[i] == '+')
{
mns[i] = mid;
}
else if (resp[i] == '-')
{
mxs[i] = mid;
}
else
{
cout << "cheater" << endl;
return 0;
}
//assert(false);
}
}
return 0;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
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;
}
详细
answer.code: In function ‘void pre()’: answer.code:32:17: error: ‘al’ was not declared in this scope; did you mean ‘ll’? 32 | al += ch; | ^~ | ll answer.code:34:17: error: ‘al’ was not declared in this scope; did you mean ‘ll’? 34 | al += ch; | ^~ | ll answer.code:36:17: error: ‘al’ was not declared in this scope; did you mean ‘ll’? 36 | al += ch; | ^~ | ll answer.code: In function ‘int solve(int)’: answer.code:49:21: error: ‘afl’ was not declared in this scope; did you mean ‘al’? 49 | string al = afl.substr(0, b); | ^~~ | al