Submission #596576

# Submission time Handle Problem Language Result Execution time Memory
596576 2022-07-14T21:04:31 Z Deepesson Brperm (RMI20_brperm) C++17
50 / 100
3000 ms 1000 KB
#include <bits/stdc++.h>
#define MAX 205000

void init(int n, const char s[]);
int query(int i, int k);
int inverte(int x,int k){
    int ans=0;
    for(int i=0;i!=k;++i){
        int u = (k-1)-i;
        if((1<<i)&x)ans+=1<<u;
    }
    return ans;
}
int lim;
char vals[MAX];
void init(int n, const char s[]) {
    for(int j=0;j!=n;++j){
        vals[j]=s[j];
    }
    lim = n;
}

int query(int i, int k) {
    int sz = 1<<(k);
    if(i+sz>lim)return 0;
    for(int j=0;j!=sz;++j){
        int mirror = inverte(j,k);
        if(vals[mirror+i]!=vals[j+i])return 0;
    }
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 27 ms 644 KB Output is correct
4 Correct 28 ms 720 KB Output is correct
5 Correct 26 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3067 ms 1000 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 27 ms 644 KB Output is correct
4 Correct 28 ms 720 KB Output is correct
5 Correct 26 ms 724 KB Output is correct
6 Execution timed out 3067 ms 1000 KB Time limit exceeded
7 Halted 0 ms 0 KB -