Submission #735071

#TimeUsernameProblemLanguageResultExecution timeMemory
735071NemanjaSo2005Mizuyokan 2 (JOI23_mizuyokan2)C++14
0 / 100
212 ms2260 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll N,Q,niz[250005]; /* 1 veci -1 manji */ ll duzina(ll gde,ll duz,ll vp,ll tip,ll kraj){ if(gde>kraj) return 0; duz+=niz[gde]; // cout<<gde<<" "<<duz<<" "<<vp<<" "<<tip<<" "<<kraj<<endl; if(duz*tip>vp*tip) return 1+duzina(gde+1,0,duz,tip*-1,kraj); if(tip==1) return duzina(gde+1,duz,vp,tip,kraj); else return duzina(gde+1,0,vp+niz[gde],tip,kraj); } int main(){ cin>>N; for(int i=1;i<=N;i++) cin>>niz[i]; cin>>Q; while(Q--){ ll a,b,L,R; cin>>a>>b>>L>>R; L++; niz[a]=b; cout<<max(duzina(L,0,1e18,-1,R),duzina(L,0,-1e18,1,R))<<endl; } return 0; } /* 4 6 2 3 2 1 3 2 1 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...