# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
494510 |
2021-12-15T16:33:39 Z |
leaked |
Brperm (RMI20_brperm) |
C++14 |
|
886 ms |
135416 KB |
#include <bits/stdc++.h>
#include "brperm.h"
#define f first
#define s second
#define m_p make_pair
#define vec vector
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fast_rmi ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=(1<<19);
int pref[N][26];
int work[N][20];
int answ[N][20];
string s;
void init(int n,const char t[]){
for(int i=0;i<n;i++){
s+=t[i];
for(int j=0;j<26;j++){
pref[i][j]=(i?pref[i-1][j]:0);
}
pref[i][s[i]-'a']++;
}
for(int j=1;j<20;j++){
for(int i=0;i<(1<<j);i++){
///TODO
for(int k=0;k<j;k++){
if((1<<k)&i)
work[i][j]+=(1<<(j-k-1));
}
answ[i][j]=-1;
}
}
}
int query(int i,int k){
if(k>20 || i+(1<<(k-1))-1>=sz(s))
return 0;
if(answ[i][k]!=-1)
return answ[i][k];
int l=i,r=i+(1<<(k-1))-1;
for(int j=0;j<26;j++){
if((pref[r][j]-(l?pref[l-1][j]:0))==(r-l+1))
return 1;
}
int ok=1;
for(int i=l;i<=r;i++){
int id=l+work[(i-l)][k];
if(s[i]!=s[id]){
ok=0;
break;
}
}
answ[i][k]=ok;
return ok;
}
//char * a;
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
82392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
82392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
886 ms |
135416 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
82392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |