QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#115727 | #6630. Triangle Collection | youngsystem | Compile Error | / | / | C++20 | 1.4kb | 2023-06-26 17:18:30 | 2023-06-26 17:18:32 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-26 17:18:32]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-06-26 17:18:30]
- 提交
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
int n=0,f=1,ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
n=n*10+ch-'0';
ch=getchar();
}
return n*f;
}
struct tree
{
int l,r,het,maxn;
}a[800004];
int ys[200005],f[200005];
void build(int l,int r,int k)
{
a[k].l=l;
a[k].r=r;
if(l==r)
{
a[k].het=f[l];
a[k].maxn=max(0,f[l]);
return;
}
build(l,(l+r)>>1,k<<1);
build(((l+r)>>1)+1,r,k<<1|1);
a[k].het=a[k<<1].het+a[k<<1|1].het;
a[k].maxn=max(a[k<<1].maxn,a[k<<1].het+a[k<<1|1].maxn);
}
void change(int x,int k,int y)
{
if(a[k].l==a[k].r)
{
a[k].het=y;
a[k].maxn=max(y,0);
return;
}
if(x<=a[k<<1].r)change(x,k<<1,y);
else change(x,k<<1|1,y);
a[k].het=a[k<<1].het+a[k<<1|1].het;
a[k].maxn=max(a[k<<1].maxn,a[k<<1].het+a[k<<1|1].maxn);
}
signed main()
{
int n,q,zs=0;
n=read();
q=read();
for(int i=1;i<=n;i++)
{
ys[i]=read();
zs+=ys[i]/2;
f[i]+=ys[i]/2;
f[i/2+1]-=(ys[i]%2);
}
build(1,n,1);
int x,y;
for(int i=1;i<=q;i++)
{
x=read();
y=read();
f[x]-=ys[x]/2;
f[x/2+1]+=(ys[x]%2);
zs-=ys[x]/2;
ys[x]+=y;
f[x]+=ys[x]/2;
f[x/2+1]-=(ys[x]%2);
zs+=ys[x]/2;
change(x,1,f[x]);
change((x+1)/2,1,f[(x+1)/2]);
printf("%lld\n",zs-(a[1].maxn+2)/3);
}
}
Details
answer.code: In function ‘void build(long long int, long long int, long long int)’: answer.code:31:30: error: no matching function for call to ‘max(int, long long int&)’ 31 | a[k].maxn=max(0,f[l]); | ~~~^~~~~~~~ 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:31:30: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 31 | a[k].maxn=max(0,f[l]); | ~~~^~~~~~~~ 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:31:30: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 31 | a[k].maxn=max(0,f[l]); | ~~~^~~~~~~~ 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:31:30: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 31 | a[k].maxn=max(0,f[l]); | ~~~^~~~~~~~ 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:31:30: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 31 | a[k].maxn=max(0,f[l]); | ~~~^~~~~~~~ answer.code: In function ‘void change(long long int, long long int, long long int)’: answer.code:44:30: error: no matching function for call to ‘max(long long int&, int)’ 44 | a[k].maxn=max(y,0); | ~~~^~~~~ 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:44:30: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’) 44 | a[k].maxn=max(y,0); | ~~~^~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1927, ...