Submission #941500

# Submission time Handle Problem Language Result Execution time Memory
941500 2024-03-09T02:42:27 Z tamir1 Growing Trees (BOI11_grow) C++17
10 / 100
1000 ms 2132 KB
#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 time Memory Grader output
1 Execution timed out 1039 ms 1624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 8 ms 516 KB Output is correct
3 Correct 5 ms 496 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 531 ms 1476 KB Output is correct
6 Correct 662 ms 1864 KB Output is correct
7 Correct 215 ms 572 KB Output is correct
8 Correct 302 ms 1380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 923 ms 1864 KB Output is correct
2 Execution timed out 1006 ms 1996 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 848 ms 2132 KB Output is correct
2 Execution timed out 1053 ms 1808 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 1448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1004 ms 1624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 1432 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 1736 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1025 ms 2120 KB Time limit exceeded
2 Halted 0 ms 0 KB -