QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#398129 | #4565. Rarest Insects | hos_lyric | Compile Error | / | / | C++14 | 901b | 2024-04-24 22:38:20 | 2024-04-24 22:38:21 |
Judging History
answer
#include "insects.h"
#include <vector>
using std::vector;
#define push move_inside
#define pop move_outside
#define get press_button
// us -> vs, ws
vector<int> us, vs, ws;
void go(int thr) {
vs.clear();
ws.clear();
for (const int u : us) {
push(u);
if (get() <= thr) {
vs.push_back(u);
} else {
pop(u);
ws.push_back(u);
}
}
}
int min_cardinality(int N) {
us.resize(N);
for (int u = 0; u < N; ++u) us[u] = u;
go(1);
const int K = vs.size();
us.swap(ws);
// keep inside: lo insects of each type
int lo = 1, hi = N / K s+ 1;
for (; lo + 1 < hi; ) {
const int mid = (lo + hi) / 2;
go(mid);
if ((int)vs.size() == K * (mid - lo)) {
lo = mid;
us.swap(ws);
} else {
hi = mid;
for (const int v : vs) pop(v);
us.swap(vs);
}
}
return lo;
}
Details
implementer.cpp:8:8: warning: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 8 | static inline constexpr int kMaxQueries = 40000; | ^~~~~~ answer.code: In function ‘int min_cardinality(int)’: answer.code:35:26: error: expected ‘,’ or ‘;’ before ‘s’ 35 | int lo = 1, hi = N / K s+ 1; | ^