# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800188 | TFF | Floppy (RMI20_floppy) | C++17 | 27 ms | 2964 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 <stdlib.h>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;
#include "floppy.h"
void read_array(int subtask_id, const vector<int> &v) {
string bits = "";
priority_queue<pair<int, int>> q;
for (int i = 0; i < (int)v.size(); i++) {
q.push({v[i], i});
}
while (!q.empty()) {
int aux = q.top().second; q.pop();
for (int i = 8; i >= 0; i--) {
if (aux > (1 << i)) {
aux -= (1 << i);
bits += "1";
} else bits += "0";
}
}
save_to_floppy(bits);
}
vector<int> solve_queries(int subtask_id, int N,
const string &bits,
const vector<int> &a, const vector<int> &b) {
vector<int> answers = {};
vector<int> nums;
for (int i = 0; i < N; i++) {
int num = 0;
for (int j = 0; j < 9; j++) {
num += (bits[9 * i + j] == '1') * (1 << (8 - j));
}
nums.push_back(num);
}
for (int i = 0; i < (int)a.size(); i++) {
for (int j = 0; j < N; j++) {
if (nums[j] >= a[i] || nums[j] <= b[i]) {
answers.push_back(nums[j]);
break;
}
}
}
return answers;
}
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... |