QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#646728 | #7703. Base Hi-Lo Game | zeyu# | AC ✓ | 1ms | 3768kb | C++23 | 3.4kb | 2024-10-17 04:34:55 | 2024-10-17 04:34:55 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pl pair<ll, ll>
#define pi pair<int, int>
#define minpq priority_queue<ll, vector<ll>, greater<ll>>
using namespace std;
#if 1
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '['; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "]";}
void _print() {cerr << endl << flush;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "*["<<__LINE__<<"]\t"<< #x << " = "; _print(x)
#endif
const ll mod = 1e9 + 7;
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll gcd(ll a, ll b) {if(b == 0){return a;} return gcd(b, a % b);}
vector<char> ds(62);
string ask(vector<int> to_ask){
string s = ""; for (int i = 0; i < to_ask.size(); i ++) s += ds[to_ask[i]];
cout << s << endl;
string ans; cin >> ans; return ans;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int b, n; cin >> b >> n;
for (int i = 0; i < 10; i ++) ds[i] = (char)(i + '0');
for (int i = 10; i < 36; i ++) ds[i] = (char)(i + 'A' - 10);
for (int i = 36; i < 62; i ++) ds[i] = (char)(i + 'a' - 36);
while(n --){
int d; cin >> d;
vector<int> ans_lx(d, 0), ans_rx(d, b - 1), ans(d, -1); bool end = false;
for (int _ = 0; _ < floor(log2(b)) + 1; _ ++){
vector<int> to_ask;
for (int i = 0; i < d; i ++){
if (ans[i] != -1) to_ask.push_back(ans[i]);
else{
int mid = (ans_lx[i] + ans_rx[i]) / 2; to_ask.push_back(mid);
}
}
string t = ask(to_ask);
if (t == "correct"){end = true; break;}
for (int i = 0; i < d; i ++){
if (t[i] == '='){
if (ans[i] == -1) ans[i] = to_ask[i];
}
if (t[i] == '-'){
if (ans[i] != -1) {
cout << "cheater" << endl; end = true;
string x; cin >> x; break;
}
ans_rx[i] = to_ask[i] - 1;
}
if (t[i] == '+'){
if (ans[i] != -1){
cout << "cheater" << endl; end = true;
string x; cin >> x; break;
}
ans_lx[i] = to_ask[i] + 1;
}
if (ans_lx[i] > ans_rx[i] || (ans[i] != -1 && (ans[i] < ans_lx[i] || ans[i] > ans_rx[i]))){
cout << "cheater" << endl; end = true;
string x; cin >> x; break;
}
if (ans_lx[i] == ans_rx[i]) {
if (ans[i] != -1 && ans[i] != ans_lx[i]){
cout << "cheater" << endl; end = true;
string x; cin >> x; break;
}
else ans[i] = ans_lx[i];
}
}
if (end) break;
}
if (! end) {cout << "cheater" << endl; string x; cin >> x;}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3768kb
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: 1ms
memory: 3688kb
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: 0
Accepted
time: 1ms
memory: 3652kb
input:
10 6 3 --+ =++ =++ =+= correct 3 -++ ==+ =-+ correct 5 +++++ ++=-- +==++ ====- correct 4 ---- ==== ++++ correct 4 ++++ ++++ ==== ++++ correct 4 ==== ==== ==== ==== correct
output:
444 117 128 139 cheater 444 177 178 cheater 44444 77777 88755 98766 cheater 4444 1111 1111 cheater 4444 7777 8888 8888 cheater 4444 4444 4444 4444 cheater
result:
ok correct (6 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
62 2 4 ==== ==== ==== ==== ==== ==== correct 64 ================================================================ ================================================================ ================================================================ =========================================================...
output:
UUUU UUUU UUUU UUUU UUUU UUUU cheater UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU UU...
result:
ok correct (2 test cases)
Test #5:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
10 10 2 -= =- correct 2 -= =- correct 2 -= =- correct 2 -= =- correct 2 -+ =- =- correct 2 -- =+ =+ =+ correct 2 -- =+ =+ =+ correct 2 -- =+ =+ =+ correct 2 -- =+ =+ =+ correct 2 -- =+ =+ =+ correct
output:
44 14 cheater 44 14 cheater 44 14 cheater 44 14 cheater 44 17 15 cheater 44 11 12 13 cheater 44 11 12 13 cheater 44 11 12 13 cheater 44 11 12 13 cheater 44 11 12 13 cheater
result:
ok correct (10 test cases)
Test #6:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
8 2 2 ++ -- correct 2 ++ -- correct
output:
33 55 44 33 55 44
result:
ok correct (2 test cases)