Submission #640120

#TimeUsernameProblemLanguageResultExecution timeMemory
640120victor_gaoFish 2 (JOI22_fish2)C++17
13 / 100
4078 ms2060 KiB
//#pragma GCC optimize("Ofast,unroll-loops,O3") //#pragma GCC optimize("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma,tune=native") #include<bits/stdc++.h> //#include<bits/extc++.h> //#pragma pack(1) #define fast ios::sync_with_stdio(0); cin.tie(0); #define int long long #define pii pair<int,int> #define x first #define y second #define N 100015 using namespace std; //using namespace __gnu_pbds; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //typedef tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> order_multiset; //typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> order_set; int n,q,arr[N]; signed main(){ fast cin>>n; for (int i=1;i<=n;i++) cin>>arr[i]; cin>>q; for (int i=1;i<=q;i++){ int type,l,r; cin>>type>>l>>r; if (type==1){ arr[l]=r; } else { int ans=0,nl,nr,now=0; for (int j=l;j<=r;j++){ nl=j-1; nr=j+1; now=arr[j]; while (nl>=l||nr<=r){ if (nl>=l&&now>=arr[nl]){ now+=arr[nl]; nl--; } else if (nr<=r&&now>=arr[nr]){ now+=arr[nr]; nr++; } else break; } if (nl<l&&nr>r) ans++; } cout<<ans<<'\n'; } } }
#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...