QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#752790 | #7780. Dark LaTeX vs. Light LaTeX | yspm | Compile Error | / | / | C++20 | 2.4kb | 2024-11-16 09:48:12 | 2024-11-16 09:48:13 |
Judging History
你现在查看的是最新测评结果
- [2024-11-25 20:53:52]
- hack成功,自动添加数据
- (/hack/1258)
- [2024-11-16 09:48:13]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-16 09:48:12]
- 提交
answer
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx;
#define For(i,x,y,...) for(int i=x,##__VA_ARGS__;i<=(y);++i)
#define rFor(i,x,y,...) for(int i=x,##__VA_ARGS__;i>=(y);--i)
#define Rep(i,x,y,...) for(int i=x,##__VA_ARGS__;i<(y);++i)
#define pb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define mkp make_pair
#define mem(a,x,n) memset(a,x,sizeof(*a)*(n+2))
typedef long long LL; typedef vector<int> Vi; typedef pair<int,int> Pii;
auto ckmax=[](auto &x,auto y) { return x<y ? x=y,true : false; };
auto ckmin=[](auto &x,auto y) { return y<x ? x=y,true : false; };
sfmt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r) { return uniform_int_distribution<>(l,r)(mt); }
const int N = 5e3+5;
int n,m;
char s[N],t[N];
LL ans;
struct Hash {
static const LL M = (1ll<<61)-1, B;
static vector<LL> pw;
vector<LL> h;
LL add(LL x,LL y) { return x+y<M ? x+y : x+y-M; }
LL mul(LL x,LL y) { __int128 z = (__int128)x*y; return add(z>>61,z&M); }
Hash(char s[]):h(strlen(s+1)+1) {
while( sz(pw) < sz(h) ) pw.pb(mul(pw.back(),B));
h[0] = 0; Rep(i,1,sz(h)) h[i] = add(mul(h[i-1],B),s[i]);
}
LL operator () (int l,int r) { return add(h[r],M-mul(h[l-1],pw[r-l+1])); }
};
const LL Hash::B = uniform_int_distribution<LL>(M/2,M-1)(mt);
vector<LL> Hash::pw = {1};
struct Ft {
int t[N*2];
void clr() { mem(t,0,n*2); }
void add(int i,int x) { for(;i;i-=i&-i)t[i]+=x; }
int sum(int i) { int res=0; for(;i<=2*n;i+=i&-i)res+=t[i]; return res; }
} ft;
void slv(bool op) {
n = strlen(s+1), m = strlen(t+1);
vector<Vi> f(n+2,Vi(n+2,0));
rFor(r,n,1) rFor(l,r,1) if( s[l] == s[r] ) f[l][r] = 1 + f[l+1][r+1];
// For(i,1,n) { For(j,i,n) cerr<<f[i][j]<<" "; cerr<<'\n'; }
Hash hs(s), ht(t);
map<LL,int> cnt;
rFor(r,n,1) {
ft.clr();
For(l,1,r) {
cnt[hs(l,r)] += ft.sum(l) + op;
// cerr<<l<<","<<r<<": "<<ft.sum(l) + op<<'\n';
ft.add(f[l][r+1]+l,1);
}
}
For(l,1,m) For(r,l,m) {
auto it = cnt.find(ht(l,r));
if( it != cnt.end() ) ans += it->se;
}
}
void MAIN() {
cin>>s+1>>t+1;
slv(0), swap(s,t), slv(1);
cout<<ans<<'\n';
} signed main() {
#ifdef FS
freopen("in","r",stdin); //freopen("out","w",stdout);
#endif
ios::sync_with_stdio(0);cin.tie(0);
int lft=1; while( lft-- ) {
MAIN();
}
return 0;
}
详细
answer.code: In function ‘void MAIN()’: answer.code:69:12: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’) 69 | cin>>s+1>>t+1; | ~~~^~~~~ | | | | | char* | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/13/sstream:40, from /usr/include/c++/13/complex:45, from /usr/include/c++/13/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127, from answer.code:1: /usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 325 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/13/istream:325:7: note: conversion of argument 1 would be ill-formed: answer.code:69:15: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’ 69 | cin>>s+1>>t+1; | ~^~ /usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 201 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:201:7: note: conversion of argument 1 would be ill-formed: answer.code:69:15: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive] 69 | cin>>s+1>>t+1; | ~^~ | | | char* answer.code:69:15: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& s)) + 1)’ to ‘long long unsigned int&’ /usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 197 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:197:7: note: conversion of argument 1 would be ill-formed: answer.code:69:15: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive] 69 | cin>>s+1>>t+1; | ~^~ | | | char* answer.code:69:15: error: cannot bind rvalue ‘(long long int)(((char*)(& s)) + 1)’ to ‘long long int&’ /usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:192:7: note: conversion of argument 1 would be ill-formed: answer.code:69:15: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive] 69 | cin>>s+1>>t+1; | ~^~ | | | char* answer.code:69:15: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& s)) + 1)’ to ‘long unsigned int&’ /usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:188:7: note: conversion of argument 1 would be ill-formed: answer.code:69:15: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive] 69 | cin>>s+1>>t+1; | ~^~ | | | char* answer.code:69:15: error: cannot bind rvalue ‘(long int)(((char*)(& s)) + 1)’ to ‘long int&’ /usr/include/c++/13/istream:184:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/13/istream:184:7: note: conversion of argument 1 would be ill-formed: answer.code:69:15: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive] 69 | cin>>s+1>>t+1; | ~^~ | | | char* answer.code:69:15: error: cannot bind rvalue ‘(unsigned int)(((char*)(& s)) + 1)’ to ‘unsigned int&’ /usr/include/c++/13/istream:181:7: note: candidate: ‘std::basic...