# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646805 | VitaliyFS | Floppy (RMI20_floppy) | C++17 | 32 ms | 3628 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) {
string bits="";
for(auto u : v) {
u+=1000000000;
for(int i=0;i<=31;i++) {
bits+=((u%2) + '0');
u/=2;
}
}
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) {
vector<int> arr;
arr.resize(N);
for(int i=0;i<N;i++) {
int num = 0, pow = 1;
for(int j=0;j<=31;j++) {
num+=(bits[i*32+j] - '0')*pow;
pow*=2;
}
arr[i]=num;
}
vector<int> answers(a.size());
for(int i=0;i<a.size();i++) {
int maxval = -1, maxid = 0;
for(int j=a[i];j<=b[i];j++) {
if(arr[j]>maxval) {
maxval=arr[j];
maxid=j;
}
}
answers[i]=maxid;
}
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... |