QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#546687 | #7703. Base Hi-Lo Game | Olegpresnyakov# | Compile Error | / | / | C++17 | 1.5kb | 2024-09-04 11:39:36 | 2024-09-04 11:39:37 |
Judging History
answer
string BASE = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
string ask(vector<int> a, int D, int B){
string res;
for(int i = 0; i < D; ++i){
res += BASE[a[i]];
}
cout << res << endl;
cout.flush();
string s;
cin >> s;
return s;
}
void solve(int B, int D){
int quest = int(log2(B));
vector<vector<int> > pars(D, vector<int> (2));
for(int i = 0; i < D; ++i){
pars[i][0] = 0;
pars[i][1] = B-1;
}
for(int i = 0; i < quest+2; ++i){
vector<int> a(D, 0);
for(int j = 0; j < D; ++j){
a[j] = (pars[j][0] + pars[j][1]) / 2;
}
string res = ask(a, D, B);
if(res == "correct"){
return;
}
for(int j = 0; j < D; ++j){
if(res[j] == '-'){
pars[j][1] = a[j]-1;
}
else if(res[j] == '+'){
pars[j][0] = a[j]+1;
}
else if(res[j] == '='){
pars[j][1] = a[j];
pars[j][0] = a[j];
}
if (pars[j][0] > pars[j][1]) {
cout << "cheater\n";
cout.flush();
string s;
cin >> s;
return;
}
}
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int B, N;
cin >> B >> N;
while(N--){
int D;
cin >> D;
solve(B, D);
}
}
詳細信息
answer.code:1:1: error: ‘string’ does not name a type 1 | string BASE = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | ^~~~~~ answer.code:2:1: error: ‘string’ does not name a type 2 | string ask(vector<int> a, int D, int B){ | ^~~~~~ answer.code: In function ‘void solve(int, int)’: answer.code:17:21: error: ‘log2’ was not declared in this scope 17 | int quest = int(log2(B)); | ^~~~ answer.code:18:5: error: ‘vector’ was not declared in this scope 18 | vector<vector<int> > pars(D, vector<int> (2)); | ^~~~~~ answer.code:18:19: error: expected primary-expression before ‘int’ 18 | vector<vector<int> > pars(D, vector<int> (2)); | ^~~ answer.code:21:9: error: ‘pars’ was not declared in this scope 21 | pars[i][0] = 0; | ^~~~ answer.code:26:16: error: expected primary-expression before ‘int’ 26 | vector<int> a(D, 0); | ^~~ answer.code:28:13: error: ‘a’ was not declared in this scope 28 | a[j] = (pars[j][0] + pars[j][1]) / 2; | ^ answer.code:28:21: error: ‘pars’ was not declared in this scope 28 | a[j] = (pars[j][0] + pars[j][1]) / 2; | ^~~~ answer.code:31:9: error: ‘string’ was not declared in this scope 31 | string res = ask(a, D, B); | ^~~~~~ answer.code:32:12: error: ‘res’ was not declared in this scope 32 | if(res == "correct"){ | ^~~ answer.code:37:16: error: ‘res’ was not declared in this scope 37 | if(res[j] == '-'){ | ^~~ answer.code:38:17: error: ‘pars’ was not declared in this scope 38 | pars[j][1] = a[j]-1; | ^~~~ answer.code:38:30: error: ‘a’ was not declared in this scope 38 | pars[j][1] = a[j]-1; | ^ answer.code:42:17: error: ‘pars’ was not declared in this scope 42 | pars[j][0] = a[j]+1; | ^~~~ answer.code:42:30: error: ‘a’ was not declared in this scope 42 | pars[j][0] = a[j]+1; | ^ answer.code:46:17: error: ‘pars’ was not declared in this scope 46 | pars[j][1] = a[j]; | ^~~~ answer.code:46:30: error: ‘a’ was not declared in this scope 46 | pars[j][1] = a[j]; | ^ answer.code:49:17: error: ‘pars’ was not declared in this scope 49 | if (pars[j][0] > pars[j][1]) { | ^~~~ answer.code:50:17: error: ‘cout’ was not declared in this scope 50 | cout << "cheater\n"; | ^~~~ answer.code:52:23: error: expected ‘;’ before ‘s’ 52 | string s; | ^~ | ; answer.code:53:17: error: ‘cin’ was not declared in this scope 53 | cin >> s; | ^~~ answer.code:53:24: error: ‘s’ was not declared in this scope 53 | cin >> s; | ^ answer.code: In function ‘int main()’: answer.code:62:5: error: ‘ios_base’ has not been declared 62 | ios_base::sync_with_stdio(false); | ^~~~~~~~ answer.code:63:5: error: ‘cin’ was not declared in this scope 63 | cin.tie(nullptr); | ^~~ answer.code:64:5: error: ‘cout’ was not declared in this scope 64 | cout.tie(nullptr); | ^~~~