# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
947023 | thunopro | Floppy (RMI20_floppy) | C++14 | 77 ms | 13684 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "floppy.h"
using namespace std;
void read_array ( int subtask_id , const std :: vector<int> &v ) {
vector<int> q;
string bits = "";
for(int x : v){
while(!q.empty() && q.back() < x) {
q.pop_back();
bits += '0';
}
q.push_back(x);
bits += '1';
}
save_to_floppy(bits);
}
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 m = (int)a.size();
vector<vector<int>> queries(N);
for(int i = 0; i < m; i++){
queries[b[i]].push_back(i);
}
int idx = -1;
vector<int> q, res(m);
for(char b : bits){
if(b == '1'){
q.push_back(++idx);
for(int i : queries[idx]){
res[i] = *lower_bound(q.begin(), q.end(), a[i]);
}
} else {
q.pop_back();
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |