Submission #951590

#TimeUsernameProblemLanguageResultExecution timeMemory
951590LittleOrangeFish 2 (JOI22_fish2)C++17
0 / 100
0 ms348 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(0);cin.tie(0); ll n; cin >> n; vector<ll> a(n); for(ll &i : a) cin >> i; ll q; cin >> q; while(q--){ ll ty; cin >> ty; if(ty==1){ ll x,y; cin >> x >> y; a[x-1] = y; }else{ ll l,r; cin >> l >> r; l--;r--; vector<ll> v; for(ll i = l;i<=r;i++) v.push_back(a[i]); sort(v.begin(),v.end()); ll w = r-l+1; vector<ll> u(w); u[0] = v[0]; for(ll i = 1;i<w;i++) u[i]=v[i]+u[i-1]; //cout << "got";for(ll i : v) cout << " " << i; cout << "\n"; //cout << "pre";for(ll i : u) cout << " " << i; cout << "\n"; ll left = w-1; while(left>0&&u[left-1]>=v[left]) left--; cout << (w-left) << "\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...