# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646576 | lis05st | Floppy (RMI20_floppy) | C++17 | 190 ms | 4912 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 "floppy.h"
#include<bits/stdc++.h>
using namespace std;
const int BITS=17;
string tostr(int x){
string res;
for(int i=BITS-1;i>=0;i--){
res+='0'+((x>>i)&1);
}
return res;
}
int fromstr(string s){
int res=0;
for(int i=0;i<BITS;i++){
res<<=1;
res+=s[i]-'0';
}
return res;
}
void read_array(int subtask_id, const std::vector<int> &v) {
vector<int>vec;
map<int,int>mp;
for(auto e:v)vec.push_back(e);
sort(vec.begin(),vec.end());
for(auto e:vec){
if(mp.count(e))continue;
mp[e]=mp.size();
}
string s;
for(auto e:v)s+=tostr(mp[e]);
save_to_floppy(s);
}
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>numbers;
for(int i=0;i<bits.size();i+=BITS){
numbers.push_back(fromstr(bits.substr(i,BITS)));
}
std::vector<int> answers;
for(int i=0;i<a.size();i++){
answers.push_back(max_element(numbers.begin()+a[i],numbers.begin()+b[i]+1)-numbers.begin());
}
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... |