QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#128271 | #6567. Repetitive String Invention | installb# | Compile Error | / | / | C++14 | 1.0kb | 2023-07-20 19:58:21 | 2023-07-20 19:58:22 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-20 19:58:22]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-07-20 19:58:21]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
#define M 805
char S[M];
int lcp[M][M],n;
using ll = long long;
int pre[M],suf[M];
int main(){
scanf("%s",S+1);
n=strlen(S+1);
for(int i=n;i>=1;i--){
lcp[i][i] = n-i+1;
for(int j=1;j<=n;j++){
if(S[i]==S[j])lcp[i][j] = lcp[i+1][j+1]+1;
else lcp[i][j] = 0;
}
}
ll ans = 0;
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
ans += min(lcp[i][j],j-i);
for(int l=2;l<=n;l++){
for(int r=l;r+1<=n;r++){
int len = r-l+1;
for(int i=n;i>=1;i--){
suf[i] = suf[i+1];
if(lcp[i][l] >= len) suf[i]++;
}
for(int i=1;i<=n;i++){
pre[i] = pre[i-1];
if(i-len>=0&&lcp[i-len+1][l] >= len)pre[i]++;
}
for(int k = 1, ed = min(l-1,n-r);k<=ed;k++){
ans += suf[r+k+1] + pre[l-k-1];
}
}
}
cout<<ans<<endl;
return 0;
}asd
Details
answer.code:41:2: error: ‘asd’ does not name a type 41 | }asd | ^~~ answer.code: In function ‘int main()’: answer.code:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s",S+1); | ~~~~~^~~~~~~~~~