QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#106482 | #6337. Mizuyokan 2 | oscaryang | Compile Error | / | / | C++17 | 3.5kb | 2023-05-17 21:25:12 | 2023-05-17 21:25:15 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-05-17 21:25:15]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-05-17 21:25:12]
- 提交
answer
#include<bits/stdc++.h>
#define ll long long
#define vc vector
#define pb emplace_back
#define int long long
#define mem(a) memset(a,0,sizeof(a))
#define memu(a) memset(a,0x3f,sizeof(a))
#define memd(a) memset(a,-0x3f,sizeof(a))
using namespace std;
const int N=3e5+5,P=998244353,lim=70;
const int inf=0x3f3f3f3f;
//in&out
inline int read() {
int x=0,w=0; char ch=getchar(); while(!isdigit(ch)) w|=(ch=='-'), ch=getchar();
while(isdigit(ch)) x=x*10+(ch^48), ch=getchar(); return w?-x:x;
}
inline void write(int x) { if(x<0) putchar('-'), x=-x; if(x>9) write(x/10); putchar(x%10+'0'); }
inline void writee(int x) { write(x); putchar(10); }
inline void writec(int x) { write(x); putchar(32); }
//calc
inline void inc(int &x,int y) { x+=y-P; x+=(x>>31)&P; }
inline void dec(int &x,int y) { x-=y; x+=(x>>31)&P; }
inline int pls(int x,int y) { return x+=y-P, x+=(x>>31)&P, x; }
inline void Min(int &x,int y) { if(x>y) x=y; }
inline void Max(int &x,int y) { if(x<y) x=y; }
int n,a[N],lp[N],rp[N];
inline void get_lp(int x) {
for(int i=x-1,s=a[i];i>=max(2,x-lim+1);i--,s+=a[i])
if(s>max(a[x],a[i-1])) return lp[x]=i-1, void();
lp[x]=0;
}
inline void get_rp(int x) {
for(int i=x+1;i<=x+lim;i++)
if(lp[i]>=x) return rp[x]=i, void();
rp[x]=n+1;
}
//segment_tree
#define mid (l+r>>1)
#define ls (k<<1)
#define rs (k<<1|1)
vc<pair<int,int> > tre[N<<2];
vc<tuple<int,int,int> > seq;
inline void psu(int k,int l,int r) {
tre[k].clear();
for(int i=l;i<=min(r,l+lim);i++)
if(i<=mid) {
auto [p,d]=tre[ls][i-l];
if(rp[p]<=r) {
auto [nx,di]=tre[rs][rp[p]-mid-1];
p=nx; d+=di+1;
}
tre[k].pb(p,d);
}
else tre[k].pb(tre[rs][i-mid-1]);
}
inline void build(int k,int l,int r) {
if(l==r) return tre[k].pb(l,0), void();
build(ls,l,mid); build(rs,mid+1,r); psu(k,l,r);
}
inline void modify(int k,int l,int r,int L,int R) {
if(L>R || L>r || R<l || l==r) return ;
modify(ls,l,mid,L,R); modify(rs,mid+1,r,L,R); psu(k,l,r);
}
inline void ask(int k,int l,int r,int L,int R) {
if(L>R || L>r || R<l) return ;
if(L<=l && R>=r) return seq.pb(k,l,r), void();
ask(ls,l,mid,L,R); ask(rs,mid+1,r,L,R);
}
inline void get_st(vc<int> &A,int x) {
int s=a[x]; A.pb(x);
for(int i=x+1;i<=min(n,x+lim);i++,s+=a[i])
if(s>a[i]) A.pb(i);
}
inline void get_ed(vc<int> &A,int x) {
int s=a[x]; A.pb(x);
for(int i=x-1;i>=max(1,x-lim);i--,s+=a[i])
if(s>a[i]) A.pb(i);
}
inline int query(int L,int R) {
int x=L,d=0;
seq.clear(); ask(1,1,n,L,R);
for(auto [k,l,r]:seq) if(x<=r) {
auto [nx,di]=tre[k][x-l];
x=nx; d+=di;
if(rp[x]>R) return d;
x=rp[nx]; ++d;
}
return d;
}
signed main() {
n=read(); for(int i=1;i<=n;i++) a[i]=read();
for(int i=1;i<=n;i++) get_lp(i);
for(int i=1;i<=n;i++) get_rp(i);
build(1,1,n);
int Q=read(),x,y,l,r,ans;
while(Q--) {
x=read(); y=read(); l=read()+1; r=read();
a[x]=y;
for(int i=x;i<=min(n,x+lim);i++) get_lp(i);
for(int i=x;i>=max(1,x-lim);i--) get_rp(i);
modify(1,1,n,max(1,x-lim),x);
vc<int> st,ed; ans=1;
get_st(st,l); get_ed(ed,r);
for(auto L:st) for(auto R:ed) if(L<=R)
Max(ans,2*query(L,R)+1+(L!=l)+(R!=r));
writee(ans);
}
return 0;
}
Details
answer.code: In function ‘void get_lp(long long int)’: answer.code:34:32: error: no matching function for call to ‘max(int, long long int)’ 34 | for(int i=x-1,s=a[i];i>=max(2,x-lim+1);i--,s+=a[i]) | ~~~^~~~~~~~~~~ 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:34:32: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 34 | for(int i=x-1,s=a[i];i>=max(2,x-lim+1);i--,s+=a[i]) | ~~~^~~~~~~~~~~ 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:34:32: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 34 | for(int i=x-1,s=a[i];i>=max(2,x-lim+1);i--,s+=a[i]) | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/11/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, 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:34:32: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 34 | for(int i=x-1,s=a[i];i>=max(2,x-lim+1);i--,s+=a[i]) | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/11/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, 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:34:32: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 34 | for(int i=x-1,s=a[i];i>=max(2,x-lim+1);i--,s+=a[i]) | ~~~^~~~~~~~~~~ answer.code: In function ‘void get_ed(std::vector<long long int>&, long long int)’: answer.code:84:25: error: no matching function for call to ‘max(int, long long int)’ 84 | for(int i=x-1;i>=max(1,x-lim);i--,s+=a[i]) | ~~~^~~~~~~~~ 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:84:25: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 84 | for(int i=x-1;i>=max(1,x-lim);i--,s+=a[i]) | ~~~^~~~~~~~~ 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:84:25: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 84 | for(int i=x-1;i>=max(1,x-lim);i--,s+=a[i]) | ~~~^~~~~~~~~ In file included from /usr...