Submission #940462

# Submission time Handle Problem Language Result Execution time Memory
940462 2024-03-07T09:38:58 Z tamir1 Growing Trees (BOI11_grow) C++17
0 / 100
1000 ms 3048 KB
#include<bits/stdc++.h>
using namespace std;
int n,m,i,l,r,c,h,x,mx,ans,cur;
char type;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	vector<int> a(2*n+5,0);
	for(i=1;i<=n;i++){
		cin >> x;
		mx=max(x,mx);
		a[x]++;
	}
	while(m--){
		cin >> type;
		if(type=='C'){
			cin >> l >> r;
			ans=0;
			for(i=l;i<=r;i++){
				ans+=a[i];
			}
			cout << ans << "\n";
		}
		else{
			cin >> c >> h;
			for(i=h;i<=mx;i++){
				if(c<=0) break;
				if(c>=a[i]){
					a[i+1]+=a[i];
					cur=a[i];
					c-=a[i];
					a[i]=0;
				}
				else{
					a[i+1]+=c;
					cur=c;
					a[i]-=c;
					c=0;
				}
			}
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 2140 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 1952 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 2120 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 556 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1040 ms 3048 KB Time limit exceeded
2 Halted 0 ms 0 KB -