QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#646706 | #7703. Base Hi-Lo Game | zeyu# | WA | 1ms | 3824kb | C++23 | 3.3kb | 2024-10-17 03:53:18 | 2024-10-17 03:53:18 |
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), ans(d, -1);
bool cheat = false, 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];
else if (ans[i] != to_ask[i]) cheat = true;
}
if (t[i] == '-'){
if (ans[i] != -1) cheat = true;
ans_rx[i] = to_ask[i] - 1;
}
if (t[i] == '+'){
if (ans[i] != -1) cheat = true;
ans_lx[i] = to_ask[i] + 1;
}
if (ans_lx[i] > ans_rx[i]) cheat = true;
if (ans_lx[i] == ans_rx[i]) {
if (ans[i] != -1 && ans[i] != ans_lx[i]) cheat = true;
else ans[i] = ans_lx[i];
}
}
}
if (end) continue;
for (int i = 0; i < d; i ++){
if (ans_lx[i] != ans_rx[i]) cheat = true;
if (ans[i] == -1) ans[i] = ans_lx[i];
else if (ans[i] != ans_lx[i]) cheat = true;
}
if (cheat) cout << "cheater" << endl;
else{
string t = ask(ans); if (t != "correct") cheat = true;
if (cheat) cout << "cheater" << endl;
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3756kb
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: 1ms
memory: 3824kb
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: 1ms
memory: 3824kb
input:
10 6 3 -++ --+ +-= correct 3 -=+ -++ +== correct 5 ++++= +=--= ==+=+ correct 4 ---- ==== ++++ ++++ correct 4
output:
555 288 069 159 555 258 059 159 55555 88885 98665 98765 5555 2222 2222 2222 cheater cheater cheater
result:
wrong answer We were told we cheated and we didn't (test case 5)