Submission #520491

# Submission time Handle Problem Language Result Execution time Memory
520491 2022-01-30T07:21:51 Z blue Growing Trees (BOI11_grow) C++17
20 / 100
1000 ms 1244 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

using vi = vector<int>;
using ll = long long;
using vll = vector<ll>;

const int mx = 100'000;

const int Z = (1<<17);


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int N, M;

	cin >> N >> M;

	vll h(N);
	for(int i = 0; i < N; i++) cin >> h[i];

	for(int j = 0; j < M; j++)
	{
		char c;
		cin >> c;

		if(c == 'C')
		{
			int mn, mx;
			cin >> mn >> mx;
			int res = 0;
			for(int i = 0; i < N; i++) res += (mn <= h[i] && h[i] <= mx);
				cout << res << '\n';
		}
		else
		{
			int c, ht;
			cin >> c >> ht;

			sort(h.begin(), h.end());

			int st = 0;
			while(st < N && h[st] < ht) st++;

			for(int j = st; j < N && j-st+1 <= c; j++)
				h[j]++;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 204 KB Output is correct
2 Correct 9 ms 332 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Correct 8 ms 332 KB Output is correct
5 Correct 556 ms 612 KB Output is correct
6 Correct 646 ms 744 KB Output is correct
7 Correct 235 ms 340 KB Output is correct
8 Correct 331 ms 612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 920 ms 628 KB Output is correct
2 Correct 971 ms 876 KB Output is correct
3 Correct 33 ms 332 KB Output is correct
4 Correct 538 ms 704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 945 ms 736 KB Output is correct
2 Execution timed out 1025 ms 900 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 1092 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 984 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 1244 KB Time limit exceeded
2 Halted 0 ms 0 KB -