#include <bits/stdc++.h>
#include "floppy.h"
using namespace std;
void read_array(int subtask_id, const std::vector<int> &v) {
string res = "";
stack<int> t;
for (int i = 0; i < v.size(); i++) {
while (!t.empty() && t.top() <= v[i]) {
res += '0';
t.pop();
}
t.push(v[i]);
res += '1';
}
save_to_floppy(res);
}
vector<int> g[200005];
std::vector<int> solve_queries(int subtask_id, int N, const std::string &bits, const std::vector<int> &a, const std::vector<int> &b) {
int n = bits.size(), q = a.size(), c = 0;
vector<int> v, res(q);
for (int i = 0; i < q; i++) {
g[b[i]].push_back(i);
}
for (int i = 0; i < N; i++) {
while (bits[c] == '0') {
v.pop_back();
c++;
}
v.push_back(i);
for (int j = 0; j < g[i].size(); j++) {
res[g[i][j]] = *lower_bound(v.begin(), v.end(), a[g[i][j]]);
}
c++;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |