# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398516 | model_code | Brperm (RMI20_brperm) | C++17 | 5038 ms | 1896 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.
/**
* user: andrei-a80
* fname: Alexandru
* lname: Andrei
* task: Brperm
* score: 83.0
* date: 2020-12-03 12:50:14.346718
*/
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#include "brperm.h"
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int n;
string a;
void init(int n,const char s[]){
for(int i=0;i<n;i++)
{
a.pb(s[i]);
}
}
int query(int i,int k){
int aba=(1<<k)-1;
if(i+(1<<k)>a.size()){
return 0;
}
for(int j=i+(1<<k)-1;j>=i;j--)
{
int x=aba;
string bit="";
//cout<<x<<' ';
for(int nr=k-1;nr>=0;nr--)
{
if(x>=(1<<nr)){
bit+='1';
x-=(1<<nr);
}else bit+='0';
}
//cout<<bit<<' ';
int indx=0;
for(int nr=0;nr<bit.size();nr++)
{
if(bit[nr]=='1'){
indx+=(1<<nr);
}
}
//cout<<indx<<' '<<j<<endl;
if(a[i+indx]!=a[j]){
return 0;
}
aba--;
}
return 1;
}
/*
int32_t main(){
CODE_START;
string val="axxyxxyb";
init(8,val);
cout<<query(0,3)<<endl;
cout<<query(1,1)<<endl;
cout<<query(3,2)<<endl;
cout<<query(1,2)<<endl;
}
*/
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |