Submission #1224346

#TimeUsernameProblemLanguageResultExecution timeMemory
1224346Sir_Ahmed_ImranBrperm (RMI20_brperm)C++17
0 / 100
55 ms2288 KiB
#include "brperm.h"
#include <bits/stdc++.h>
using namespace std;
#define N 500001
#define nl '\n'
#define ff first
#define ss second
#define add insert
#define ll long long
#define ld long double
#define terminator main
#define pll pair<ll,ll>
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int n;
char a[N];

int rev(int x, int k){
    int ans = 0;
    for(int i = 0; i < k; i++)
        if((x >> i) & 1)
            ans += (1 << (k - i - 1));
    return ans; 
}

void init(int x, const char s[]) {
    int n = x;
    for(int i = 0; i < n; i++)
        a[i] = s[i];
}

int query(int x, int k) {
    if(x + (1 << k) > n)
        return 0;
    for(int i = x; i < x + (1 << k); i++)
        if(a[i] != a[x + rev(i - x, k)])
            return 0;
    return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...