QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#137483 | #2354. Ook | Rd_rainydays# | Compile Error | / | / | C++20 | 1.6kb | 2023-08-10 13:18:37 | 2023-08-10 13:18:37 |
Judging History
This is the latest submission verdict.
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-08-10 13:18:37]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2023-08-10 13:18:37]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),i##_end_=(b);i<i##_end_;++i)
static const int M=250003;
int o,k,Fa[M];
char S[M],P[M];
int Nxt[M],n,m;
int Sum[M],Val[M];
int GetFa(int x){return Fa[x]==x?x:Fa[x]=GetFa(Fa[x]);}
vector<int>QO,QK;
int F[M];
int main(){
scanf("%d%d",&o,&k);
scanf("%s%s",S+1,P);
n=strlen(S+1);int op=n+1,kp=n+1;
m=strlen(P);
REP(i,1,n+1)
if(S[i]=='o')QO.push_back(i);
else QK.push_back(i);
for(int i=n;i>=1;--i){
if(S[i]=='o')Nxt[i]=op,op=i;
else Nxt[i]=kp,kp=i;
}
REP(i,1,n+1){
Sum[i]=Sum[i-1]+(S[i]=='o'?o:k);
Fa[i]=i;
}
REP(i,1,n-m+2)
Val[i]=Sum[i+m-1]-Sum[i-1];
//REP(i,1,n-m+2)cout<<Sum[i]<<' ';cout<<endl;
REP(i,0,strlen(P)){
if(P[i]=='?')continue;
int p;
if(P[i]=='k'){
p=lower_bound(QO.begin(),QO.end(),i+1)-QO.begin();
int pe=QO.size();
while(p<pe){
if(QO[p]-i>n-m+1)break;
if(!(Val[QO[p]-i]>>=1))
Fa[QO[p]-i]=QO[p]-i+1;
p=max(p+1,lower_bound(QO.begin(),QO.end(),GetFa(QO[p]-i)+i+1)-QO.begin());
}
}
else{
p=lower_bound(QK.begin(),QK.end(),i+1)-QK.begin();
int pe=QK.size();
while(p<pe){
if(QK[p]-i>n-m+1)break;
if(!(Val[QK[p]-i]>>=1))
Fa[QK[p]-i]=QK[p]-i+1;
p=max(p+1,lower_bound(QK.begin(),QK.end(),GetFa(QK[p]-i)+i+1)-QK.begin());
}
}
}
REP(i,1,n+2){
if(i<=n-m+1)
F[i+m]=max(F[i+m],F[i]+Val[i]);
F[i]=max(F[i],F[i-1]);
}
printf("%d\n",F[n+1]);
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:47:14: error: no matching function for call to ‘max(int, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)’ 47 | p=max(p+1,lower_bound(QO.begin(),QO.end(),GetFa(QO[p]-i)+i+1)-QO.begin()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from answer.code:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: answer.code:47:14: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type’ {aka ‘long int’}) 47 | p=max(p+1,lower_bound(QO.begin(),QO.end(),GetFa(QO[p]-i)+i+1)-QO.begin()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from answer.code:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: answer.code:47:14: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type’ {aka ‘long int’}) 47 | p=max(p+1,lower_bound(QO.begin(),QO.end(),GetFa(QO[p]-i)+i+1)-QO.begin()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)’ 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: answer.code:47:14: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 47 | p=max(p+1,lower_bound(QO.begin(),QO.end(),GetFa(QO[p]-i)+i+1)-QO.begin()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)’ 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: answer.code:47:14: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 47 | p=max(p+1,lower_bound(QO.begin(),QO.end(),GetFa(QO[p]-i)+i+1)-QO.begin()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:57:14: error: no matching function for call to ‘max(int, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)’ 57 | p=max(p+1,lower_bound(QK.begin(),QK.end(),GetFa(QK[p]-i)+i+1)-QK.begin()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h...