QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#734766 | #7780. Dark LaTeX vs. Light LaTeX | acb437 | Compile Error | / | / | C++14 | 1.2kb | 2024-11-11 14:59:27 | 2024-11-11 14:59:33 |
Judging History
This is the latest submission verdict.
- [2024-11-25 20:53:52]
- hack成功,自动添加数据
- (/hack/1258)
- [2024-11-11 14:59:33]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-11 14:59:27]
- Submitted
answer
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 5e3 + 5;
char s[N], t[N];
int n, m, f[N][N];ll ans;
ll g[N][N], h[N][N], sum[N][N];
void solve(char s[], char t[], int n, int m)
{
memset(g, 0, sizeof(g));
memset(h, 0, sizeof(h));
memset(sum, 0, sizeof(sum));
for(int i = 1;i <= n;i++)
{
for(int j = 1;j <= m;j++)
g[i][j] = (s[i] == t[j]) * (1 + g[i - 1][j - 1]), sum[i][g[i][j]]++;
for(int j = n;j >= 1;j--)sum[i][j] += sum[i][j + 1];
for(int j = 1;j <= n;j++)sum[i][j] += sum[i][j - 1];
}
for(int i = n;i >= 1;i--)
for(int j = n;j > i + 1;j--)
h[i][j] = (s[i] == s[j]) * (1 + h[i + 1][j + 1]);
for(int i = 1;i <= n;i++)
for(int j = i + 2;j <= n;j++)
ans += sum[j - 1][j - i - 1] - sum[j - 1][max(j - i - h[i][j], 1) - 1];
}
int main()
{
scanf("%s%s", s + 1, t + 1), n = strlen(s + 1), m = strlen(t + 1);
for(int i = n;i >= 1;i--)
for(int j = m;j >= 1;j--)
f[i][j] = (s[i] == t[j]) * (1 + f[i + 1][j + 1]), ans += f[i][j];
solve(s, t, n, m), solve(t, s, m, n);
return printf("%lld\n", ans) & 0;
}
Details
answer.code: In function ‘void solve(char*, char*, int, int)’: answer.code:28:58: error: no matching function for call to ‘max(ll, int)’ 28 | ans += sum[j - 1][j - i - 1] - sum[j - 1][max(j - i - h[i][j], 1) - 1]; | ~~~^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from answer.code:3: /usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: answer.code:28:58: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’) 28 | ans += sum[j - 1][j - i - 1] - sum[j - 1][max(j - i - h[i][j], 1) - 1]; | ~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed: answer.code:28:58: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’) 28 | ans += sum[j - 1][j - i - 1] - sum[j - 1][max(j - i - h[i][j], 1) - 1]; | ~~~^~~~~~~~~~~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:33:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | scanf("%s%s", s + 1, t + 1), n = strlen(s + 1), m = strlen(t + 1); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~