QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#105559 | #6394. Turn on the Light | woyouxiangbaile# | WA | 2ms | 3332kb | C++14 | 1.4kb | 2023-05-14 13:20:42 | 2023-05-14 13:20:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, d, u) for(int i = d; i <= u; ++i)
#define dep(i, u, d) for(int i = u; i >= d; --i)
#define cep(n) while(n--)
#define gep(i, a) for(int i = firs[a]; i; i = neig[i])
int ured() {
int re = 0;
char ch;
do {
ch = getchar();
} while('9' < ch || ch < '0');
do {
re = re * 10 + (ch ^ '0');
} while('0' <= (ch = getchar()) && ch <= '9');
return re;
}
void uwit(int da) {
int ch[21], cn = 0;
do {
ch[++cn] = da - da / 10 * 10;
} while(da /= 10);
do {
putchar('0' ^ ch[cn]);
} while(--cn);
}
const int _maxn = 1000011;
int n, efle, efri, efmi, efan, lans, rans, tans, matp;
vector<int> rest, cpys;
int quer(int at) {
putchar('?'), putchar(' '), uwit(at), putchar('\n'), fflush(stdout);
return ured();
}
int main() {
n = ured();
rep(i, 1, n) {
rest . push_back(i);
}
while(rest . size()) {
if((lans = quer(rest[0])) == tans) {
putchar('!'), putchar(' '), uwit(rest[0]), putchar('\n'), fflush(stdout);
return 0;
}
if((rans = quer(rest[matp = rest . size() >> 1])) == lans) {
putchar('!'), putchar(' '), uwit(rest[0]), putchar('\n'), fflush(stdout);
return 0;
}
tans = rans, cpys = rest, rest . clear();
if(rans == tans) {
rep(i, 1, matp - 1) {
rest . push_back(cpys[i]);
}
} else {
rep(i, matp + 1, cpys . size() - 1) {
rest . push_back(cpys[i]);
}
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3332kb
input:
3 1 2
output:
? 1 ? 2
result:
wrong answer format Unexpected end of file - token expected