Submission #941500

#TimeUsernameProblemLanguageResultExecution timeMemory
941500tamir1Growing Trees (BOI11_grow)C++17
10 / 100
1070 ms2132 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll n,m,i,c,h,l,r,a[100005],ans; char type; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(i=1;i<=n;i++){ cin >> a[i]; } sort(a+1,a+n+1); while(m--){ cin >> type; if(type=='F'){ cin >> c >> h; for(i=1;i<=n;i++){ if(a[i]>=h && c>0){ a[i]++; c--; } } sort(a+1,a+n+1); } else{ cin >> l >> r; ans=0; for(i=1;i<=n;i++){ if(a[i]>=l && a[i]<=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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...