Submission #642741

# Submission time Handle Problem Language Result Execution time Memory
642741 2022-09-20T12:35:54 Z TimDee Brperm (RMI20_brperm) C++17
50 / 100
3000 ms 1648 KB
#include "brperm.h"
#include <bits/stdc++.h>
using namespace std;

char S[(int)1e5+10];
int n;
void init(int N, const char s[]) {
    n=N;
    for (int i=0; i<n; ++i) S[i]=s[i];
}

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

int query(int ind, int k) {

    if (ind + (1ll<<k) -1 >=n) return false;
    for (int i=ind; i<ind+(1ll<<k); ++i) {
        int j=rev(i-ind,k);
        //if ((j+ind>=S.length()) || (i>>S.length())) return false;
        //cout<<i<<' '<<j+ind<<'\n';
        if (S[i]!=S[j+ind]) return false;
    }
    return true;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 27 ms 1620 KB Output is correct
4 Correct 27 ms 1604 KB Output is correct
5 Correct 26 ms 1648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3087 ms 1052 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 336 KB Output is correct
3 Correct 27 ms 1620 KB Output is correct
4 Correct 27 ms 1604 KB Output is correct
5 Correct 26 ms 1648 KB Output is correct
6 Execution timed out 3087 ms 1052 KB Time limit exceeded
7 Halted 0 ms 0 KB -