# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1060497 | 2024-08-15T16:17:16 Z | presko | Brperm (RMI20_brperm) | C++14 | 3000 ms | 91932 KB |
#include<bits/stdc++.h> #include "brperm.h" #define MAXN 500010 #define LOGN 23 using namespace std; long long tab[MAXN][LOGN]; string str=""; //transition: x-> r*(2^(k-bits)), bits=log2(x), r=transition for x in base form //unchanged: 2^(k/2)*fl, fl=1 for k%2=0, otherwise fl=2 //changed: (2^k - unchanged)/2 void init(int n, const char s[]) { str=s[0]; for(int j=0;j<=20;j++){tab[0][j]=0;} for(int i=1;i<n;i++) { str+=s[i]; int logx=log2(i)+1; int si=i,cntr=1; long long m=0; while(si>0) { bool bit=si&1; long long ncalc=logx-cntr; ncalc=1<<ncalc; m+=bit*ncalc; si>>=1; cntr++; } tab[i][logx]=m; for(int j=logx+1;j<=20;j++) { tab[i][j]=tab[i][j-1]<<1; } } } int query(int i, int k) { int lim=(1<<k); for(int curr=0;curr<lim;curr++) { if(i+curr>=str.size())return 0; if(str[i+curr]!=str[i+tab[curr][k]])return 0; } return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 9308 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 9308 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3019 ms | 91932 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 9308 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |