QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#506421#7804. Intersegment ActivationWall_breakerCompile Error//C++14938b2024-08-05 17:21:012024-08-05 17:21:02

Judging History

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

  • [2024-08-05 17:21:02]
  • 评测
  • [2024-08-05 17:21:01]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector <int> q[11];
int ask(int l, int r) {
	cout << l << ' ' << r << '\n';
	cout << flush;
	int ret;
	cin >> ret;
	return ret;
}
int cnt, cur, n;
bool dfs(int dep) {
	if (dep == q[cnt].size()) return false;
	if (dfs(dep + 1)) {
		if (cur == n) return true;
		return true;
	}
	int temp = ask(cnt, q[cnt][dep]);
	if (temp == n) {
		cur = n;
		return true;
	}
	if (temp < cur) {
		flg = true;
		temp = ask(cnt, q[cnt][dep]);
		cur = temp;
	}
	if (temp > cur) {
		cur = temp;
		flg = true;
	}
	if (dfs(dep + 1)) {
		if (cur == n) return true;
		return true;
	}	
	return flg;
}
int main() {
	cin >> n;
	
	for (int i = 1; i <= n; i ++) {
		for (int j = n; j >= i; j --) {
			q[i].push_back(j);
		}
	}
	cin >> cur;
	
	cnt = 1;
	while (cur != n && cnt != n + 1) {
		dfs(0);
		cnt ++;
	}
	assert(cur == n);
    return 0;
}

詳細信息

answer.code: In function ‘bool dfs(int)’:
answer.code:25:17: error: ‘flg’ was not declared in this scope
   25 |                 flg = true;
      |                 ^~~
answer.code:31:17: error: ‘flg’ was not declared in this scope
   31 |                 flg = true;
      |                 ^~~
answer.code:37:16: error: ‘flg’ was not declared in this scope
   37 |         return flg;
      |                ^~~