# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
596600 | Deepesson | Brperm (RMI20_brperm) | C++17 | 610 ms | 24900 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define MAX 505000
void init(int n, const char s[]);
int query(int i, int k);
std::vector<int> cores[26];
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 pec[MAX][20];
int lim;
char vals[MAX];
void init(int n, const char s[]) {
for(int j=0;j!=n;++j){
vals[j]=s[j];
cores[s[j]-'a'].push_back(j);
}
for(int i=0;i!=20;++i){
int sz = 1<<i;
if(sz>MAX)break;
for(int k=0;k!=sz;++k){
pec[k][i]=inverte(k,i);
}
}
lim = n;
}
int query(int i, int k) {
int sz = 1<<(k);
if(i+sz>lim)return 0;
int count=0;
for(int j=0;j!=sz;++j){
int mirror = pec[j][k];
count++;
if(vals[mirror+i]!=vals[j+i])return 0;
if(count==505)break;
}
///Ideia: testar um tiquinho de cada cor
for(int j=0;j!=26;++j){
int l=0,r=cores[j].size();
while(l<r){
int m = (l+r)/2;
if(cores[j][m]>i){
r=m;
}else l=m+1;
}
int anda=0;
while(l<cores[j].size()&&anda<50&&cores[j][l]<i+sz){
int pos = cores[j][l];
int mirror = pec[pos-i][k];
count++;
if(vals[mirror+i]!=vals[j+i])return 0;
++anda;
++l;
}
}
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |