QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#646720 | #7703. Base Hi-Lo Game | zeyu# | WA | 1ms | 3668kb | C++23 | 3.2kb | 2024-10-17 04:13:10 | 2024-10-17 04:13:11 |
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);
for (int _ = 0; _ < floor(log2(b)) + 2; _ ++){
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") break;
bool end = false;
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]){
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;
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3668kb
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: 0ms
memory: 3556kb
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: -100
Wrong Answer
time: 1ms
memory: 3608kb
input:
10 6 3 --+ =++ =++ =+= correct 3 -++ ==+ =-+ correct 5 +++++ ++=-- +==++ ====- correct 4 ---- ==== ++++ correct 4 ++++ ++++ ==== ++++ correct 4 ==== ==== ==== ==== ====
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 4444
result:
wrong answer Didn't get to correct answer in 5 guesses (test case 6)