QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#72185#4565. Rarest InsectsAuroraCompile Error//C++14696b2023-01-14 21:50:182023-01-14 21:50:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-14 21:50:20]
  • 评测
  • [2023-01-14 21:50:18]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>
const int N = 1e5;
using namespace std;
mt19937 rand1(time(0))


int cnt, opt[N + 5];
int query() {return press_button();}

int min_cardinality(int n) {
	for(int i = 1; i <= n; ++i) {
		move_inside(i - 1);
		if (query() > 2) move_outside(i - 1);
		else ++cnt;
	}
	int l = 1, r = n, mid, ans;
	while(l <= r) {
		int now = 0; mid = l + r >> 1;
		for(int i = 1; i <= n; ++i) opt[i] = i;
		shuffle(opt + 1, opt + n + 1, rand1);
		for(int i = 1; i <= n; ++i) {
			move_inside(i - 1); ++now;
			if (query() > k) move_outside(i - 1), --now;
		}
		if (now < cnt * k) r = mid - 1;
		else l = mid + 1, ans = mid;;
	}
	return ans;
}

詳細信息

implementer.cpp:8:8: warning: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’
    8 | static inline constexpr int kMaxQueries = 40000;
      |        ^~~~~~
answer.code:8:1: error: expected ‘,’ or ‘;’ before ‘int’
    8 | int cnt, opt[N + 5];
      | ^~~
answer.code: In function ‘int min_cardinality(int)’:
answer.code:15:24: error: ‘cnt’ was not declared in this scope; did you mean ‘int’?
   15 |                 else ++cnt;
      |                        ^~~
      |                        int
answer.code:20:45: error: ‘opt’ was not declared in this scope
   20 |                 for(int i = 1; i <= n; ++i) opt[i] = i;
      |                                             ^~~
answer.code:21:25: error: ‘opt’ was not declared in this scope
   21 |                 shuffle(opt + 1, opt + n + 1, rand1);
      |                         ^~~
answer.code:24:39: error: ‘k’ was not declared in this scope
   24 |                         if (query() > k) move_outside(i - 1), --now;
      |                                       ^
answer.code:26:27: error: ‘cnt’ was not declared in this scope; did you mean ‘int’?
   26 |                 if (now < cnt * k) r = mid - 1;
      |                           ^~~
      |                           int
answer.code:26:33: error: ‘k’ was not declared in this scope
   26 |                 if (now < cnt * k) r = mid - 1;
      |                                 ^