QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#105559#6394. Turn on the Lightwoyouxiangbaile#WA 2ms3332kbC++141.4kb2023-05-14 13:20:422023-05-14 13:20:44

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-14 13:20:44]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3332kb
  • [2023-05-14 13:20:42]
  • 提交

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