QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#876448 | #7703. Base Hi-Lo Game | Teapot | AC ✓ | 1ms | 3712kb | C++17 | 3.0kb | 2025-01-30 21:24:40 | 2025-01-30 21:24:40 |
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;
}
bool o = true;
FOR(i,0,sz(a))
if(a[i] != '=')
o = false;
if(o)
{
cout << "cheater" << endl;
cin >> a;
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="";
FOR(i,0,d)
{
cerr << g[i].x << ' ' << g[i].y << endl;
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: 3584kb
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: 3712kb
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: 0
Accepted
time: 1ms
memory: 3712kb
input:
10 6 3 -++ --+ +-= correct 3 -=+ -++ correct 5 ++++= +=--= ==+=+ correct 4 ---- ==== correct 4 ++++ ++++ ==== correct 4 ==== correct
output:
555 288 069 cheater 555 258 cheater 55555 88885 98665 cheater 5555 2222 cheater 5555 8888 9999 cheater 5555 cheater
result:
ok correct (6 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
62 2 4 ==== correct 64 ================================================================ correct
output:
VVVV cheater VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV cheater
result:
ok correct (2 test cases)
Test #5:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
10 10 2 -= -- correct 2 -= -- correct 2 -= -- correct 2 -= -- correct 2 -= -- correct 2 -+ -- +- correct 2 -- -+ ++ =+ correct 2 -- -+ ++ =+ correct 2 -- -+ ++ =+ correct 2 -- -+ ++ =+ correct
output:
55 25 cheater 55 25 cheater 55 25 cheater 55 25 cheater 55 25 cheater 55 28 06 cheater 55 22 03 14 cheater 55 22 03 14 cheater 55 22 03 14 cheater 55 22 03 14 cheater
result:
ok correct (10 test cases)
Test #6:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
8 2 2 correct 2 correct
output:
44 44
result:
ok correct (2 test cases)