QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#748821 | #7780. Dark LaTeX vs. Light LaTeX | monui | Compile Error | / | / | C++23 | 1.5kb | 2024-11-14 21:35:18 | 2024-11-14 21:35:19 |
Judging History
你现在查看的是最新测评结果
- [2024-11-25 20:53:52]
- hack成功,自动添加数据
- (/hack/1258)
- [2024-11-14 21:35:19]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-14 21:35:18]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define lowbit(x) x&(-x)
using ll=__int128;
const int N=5010;
const ll M=1e17+3;
string a,b;
unordered_map<int,int> st_a,st_b;
int na,nb;
void calc(string& s,int len,unordered_map<int,int>& st,ll* ans,int d){
vector<vector<int>> op(N,vector<int>(N,0));
vector<int> lst(N,0);
for(int i=1;i<=len;i++){
for(int j=len;j>i;j--){
lst[j]=0;
if(s[i]!=s[j]) continue;
if(s[i-1]==s[j-1]) lst[j]=lst[j-1]+1;
op[i+1][j]-=1;
op[i+1][max(j-lst[j]-1,i+1)]+=1;
}
}
for(int i=1;i<=len;i++){
int res=0;
ll to=0;
for(int j=i;j<=len;j++){
res+=op[i][j];
int num=res+d;
to=(to*31+s[j]-'a'+13)%M;
if(num<=0) continue;
st[to]+=num;
}
}
}
int getans(string& s,int len,unordered_map<int,int>& st,ll* ans){
int res=0;
for(int i=1;i<=len;i++){
ll to=0;
for(int j=i;j<=len;j++){
to=(to*31+s[j]-'a'+13)%M;
res+=st[to];
}
}
return res;
}
void solve(){
cin>>a>>b;
na=a.size(),nb=b.size();
a="#"+a;b="#"+b;
calc(a,na,st_a,hash_a,1);
calc(b,nb,st_b,hash_b,0);
int res=getans(a,na,st_b,hash_a)+getans(b,nb,st_a,hash_b);
cout<<res<<endl;
}
signed main()
{
ios::sync_with_stdio(0);cin.tie(0);
int t=1;
// cin>>t;
while(t--)
solve();
return 0;
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:54:20: error: ‘hash_a’ was not declared in this scope 54 | calc(a,na,st_a,hash_a,1); | ^~~~~~ answer.code:55:20: error: ‘hash_b’ was not declared in this scope 55 | calc(b,nb,st_b,hash_b,0); | ^~~~~~