QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#876308 | #7703. Base Hi-Lo Game | Teapot# | WA | 0ms | 3840kb | C++17 | 2.7kb | 2025-01-30 19:52:18 | 2025-01-30 19:52:19 |
Judging History
answer
/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double ld;
typedef __int128_t ill;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
vector<pll> g(200);
bool t;
bool ask(string s)
{
cout << s << endl;
string a;
cin >> a;
if(a == "correct"){
t = false;
return 0;
}
ll n = sz(s);
FOR(i,0,n)
{
if(a[i] == '=')
{
g[i].x = (g[i].x+g[i].y)/2;
g[i].y = g[i].x;
continue;
}
if(g[i].x >= g[i].y){
cout << "cheater" << endl;
cin >> a;
t = false;
return 0;
}
if(a[i] == '+')
g[i].x = (g[i].x + g[i].y)/2+1;
else
g[i].y = (g[i].x + g[i].y)/2-1;
}
FOR(i,0,n)
if(g[i].x > g[i].y){
cout << "cheater" << endl;
cin >> a;
t = false;
return 0;
}
return 0;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
vector<char> ar;
FOR(i,0,10)
ar.pb(i+'0');
FOR(i,0,26)
ar.pb(i + 'A');
FOR(i,0,26)
ar.pb(i+'a');
ll b,n,d;
cin >> b >> n;
FOR(_,0,n)
{
cin >> d;
FOR(i,0,d){
g[i].x = 0;
g[i].y = b;
}
t = true;
ll coun = 0;
while(t)
{
string s="";
assert(coun < log2(b) + 2);
FOR(i,0,d)
{
ll m = (g[i].x + g[i].y)/2;
if(m >= b){
cout << "cheater" << endl;
cin >> s;
t = false;
break;
}
s += ar[m];
}
if(!t)
break;
coun++;
ask(s);
}
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3840kb
input:
10 2 5 ----= -=++= +==+= correct 6 --++-+ =+-=-+ =+==== correct
output:
55555 22225 02335 12345 555555 228828 236809 246809
result:
ok correct (2 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
38 2 1 + + + + correct 3 --- +-= --= --= correct
output:
J T Y a b JJJ 999 E49 B19 A09
result:
ok correct (2 test cases)
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3712kb
input:
10 6 3 -++ --+ +-= correct 3 -=+ -++ correct 5 ++++= +=--= ==+=+ correct 4 ---- ==== ++++ correct 4 ++++ ++++ ==== correct 4 ==== ==== ==== ==== ====
output:
555 288 069 cheater 555 258 cheater 55555 88885 98665 cheater 5555 2222 2222 cheater 5555 8888 9999 9999 5555 5555 5555 5555 5555 5555
result:
wrong answer Didn't get to correct answer in 5 guesses (test case 6)