QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#363783 | #7703. Base Hi-Lo Game | pipoika# | TL | 1ms | 3596kb | C++23 | 1.4kb | 2024-03-24 03:20:41 | 2024-03-24 03:20:42 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,j,k) for (int i=j;i<(k);++i)
#define all(i) (i).begin(),(i).end()
#define sz(i) (int)(i).size()
using namespace std;
typedef vector<int> vi;
vector<char> chars;
int b, n;
void solve() {
int d;
cin >> d;
vi lows(d, 0);
vi highs(d, b-1);
vi guess(d, 0);
while (true) {
rep(i,0,d) {
guess[i] = (lows[i] + highs[i])/2;
cout << chars[guess[i]];
}
cout << endl;
string res;
cin >> res;
if (!res.compare("correct")) return;
rep(i,0,d) {
if (res[i] == '-') {
highs[i] = min(highs[i], guess[i]-1);
}
if (res[i] == '+') {
lows[i] = max(lows[i], guess[i]+1);
}
if (res[i] == '=') {
lows[i] = max(lows[i], guess[i]);
highs[i] = min(highs[i], guess[i]);
}
if (highs[i] < lows[i]) {
cout << "cheater" << endl;
cin >> res;
return;
}
}
// break;
}
}
int main() {
for(char c='0';c<='9';++c) chars.push_back(c);
for(char c='A';c<='Z';++c) chars.push_back(c);
for(char c='a';c<='z';++c) chars.push_back(c);
cin >> b >> n;
while (n--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
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: 3596kb
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
Time Limit Exceeded
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 4444